示例#1
0
 protected function setTableData(ZfObject\AbstractTableObject $table, array $data)
 {
     $columns = [];
     foreach ($data['columns'] as $col) {
         $c = new Object\ColumnObject($col['name'], $col['tableName'], $col['schemaName']);
         $c->setType($col['type']);
         $c->setOrdinalPosition($col['ordinalPosition']);
         $c->setColumnDefault($col['columnDefault']);
         $c->setIsNullable($col['isNullable']);
         $c->setDataType($col['dataType']);
         $c->setCharacterMaximumLength($col['characterMaximumLength']);
         $c->setCharacterOctetLength($col['characterOctetLength']);
         $c->setNumericPrecision($col['numericPrecision']);
         $c->setNumericUnsigned($col['numericUnsigned']);
         $c->setErratas($col['errata']);
         $columns[$col['name']] = $c;
     }
     $table->setColumns($columns);
     $constraints = [];
     foreach ($data['constraints'] as $cons) {
         $c = new ZfObject\ConstraintObject($cons['name'], $cons['tableName'], $cons['schemaName']);
         $c->setType($cons['type']);
         $c->setColumns($cons['columns']);
         $c->setReferencedTableSchema($cons['referencedTableSchema']);
         $c->setReferencedTableName($cons['referencedTableName']);
         $c->setReferencedColumns($cons['referencedColumns']);
         $c->setMatchOption($cons['matchOption']);
         $c->setUpdateRule($cons['updateRule']);
         $c->setDeleteRule($cons['deleteRule']);
         $c->setCheckClause($cons['checkClause']);
         $constraints[] = $c;
     }
     $table->setConstraints($constraints);
 }
 public function getColumn($columnName, $table, $schema = null)
 {
     $base = parent::getColumn($columnName, $table, $schema = null);
     $column = Object\ColumnObject::createFromBase($base);
     return $column;
 }