Пример #1
0
 /**
  * Returns the foreign key objects for this column.
  *
  * Only if it is a foreign key or part of a foreign key.
  *
  * @return ForeignKey[]
  */
 public function getForeignKeys()
 {
     return $this->parentTable->getColumnForeignKeys($this->name);
 }
 public function testGetColumnForeignKeys()
 {
     $fk1 = $this->getForeignKeyMock('fk1', array('local_columns' => array('foo', 'author_id', 'bar')));
     $fk2 = $this->getForeignKeyMock('fk2', array('local_columns' => array('foo', 'bar')));
     $table = new Table();
     $table->addForeignKey($fk1);
     $table->addForeignKey($fk2);
     $this->assertCount(1, $table->getColumnForeignKeys('author_id'));
     $this->assertContains($fk1, $table->getColumnForeignKeys('author_id'));
 }
 protected function addParentColumn(Table $table, $id_name)
 {
     $name = $this->getParameter('parent_name');
     //Остановился тут
     if (!$table->getColumnForeignKeys($name)) {
         //var_dump($table->getColumnForeignKeys('parent_id'));
         //foreach($table->getForeignKeys() as $column) {
         //    var_dump($column->getForeignColumns(), $column->getName());
         //}
     }
     foreach ($table->getDatabase()->getTables() as $table) {
         //echo $table->getName()."\n";
     }
     //exit;
 }