getColumn() public method

public getColumn ( $name )
Beispiel #1
0
 public function buildForeignKeys(SchemaInterface $schema)
 {
     return array();
     // FIXME
     $sqls = array();
     if ($this->driver->type == 'sqlite') {
         return $sqls;
     }
     foreach ($schema->relations as $rel) {
         switch ($rel['type']) {
             case Relationship::BELONGS_TO:
             case Relationship::HAS_MANY:
             case Relationship::HAS_ONE:
                 if (isset($rel['self_column']) && $rel['self_column'] != 'id') {
                     $n = $rel['self_column'];
                     $column = $schema->getColumn($n);
                     if ($column->isa == "str") {
                         continue;
                     }
                     $fSchema = new $rel['foreign_schema']();
                     $constraint = new Constraint();
                     $constraint->foreignKey($rel['self_column']);
                     $constraint->reference($fSchema->getTable(), (array) $rel['foreign_column']);
                     // $constraint->onUpdate('CASCADE');
                     // $constraint->onDelete('CASCADE');
                     $sqls[] = $query->toSql($this->driver, new ArgumentArray());
                 }
         }
     }
     return $sqls;
 }