static function fieldReferences(CreateTable $structure, TableReferenceInstance $table) { $ret = array(); foreach ($structure as $field => $statement) { $ref = ModelReference::Find($field); if ($ref != $table) { $ret[$field] = new ColumnReference($ref->getTable(), $field); } } return $ret; }
private function isReference($databaseField) { $structure = $this->structure; if ($structure->engine == 'innodb') { $relation = $structure[$databaseField]->getRelation(); if (!$relation) { return false; } $reference = $relation->getReference(); //Get related mapping object and translate to Objective from that if (!$reference) { throw new \Exception('Couldnt parse relation reference'); } return $reference; } $ref = ModelReference::Find($databaseField); if ($ref->getName() == $this->tableInfo['name']) { return false; } return new ColumnReference($ref->getTable(), $databaseField); }