private function findRelationships(TableInformation $table) { foreach ($table->columns as $column) { if ($column->isForeign) { $foreign_table = $this->tables[$column->foreignTable]; if ($table->isLink()) { $foreign_table->links[] = new LinkInformation($this, $table, $foreign_table); } else { //$foreign_table->links[] = new OneToManyLinkInformation($table, $foreign_table, $column); } } } }
public function __construct(SchemaInformation $schema, TableInformation $link_table, TableInformation $perspective_table) { if (!$link_table->isLink()) { throw new Exception('Attempted to create LinkInformation from a non-link table.'); } $this->schema = $schema; $this->table = $link_table; $this->discover($perspective_table); /*print_r([ 'localColumn' => $this->localColumn, 'localTable' => $this->localTable->name, 'localLinkColumn' => $this->localLinkColumn, 'linkTable' => $this->table->name, 'remoteTable' => $this->remoteTable->name, 'remoteColumn' => $this->remoteColumn, 'remoteLinkColumn' => $this->remoteLinkColumn, ]);*/ }