From e22ad5baaeafe01f91056b91f29df51d4ed23c03 Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Fri, 21 Sep 2007 03:18:50 +0000 Subject: [PATCH] gnats changes. --- lib/Doctrine/Import/Schema.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/Import/Schema.php b/lib/Doctrine/Import/Schema.php index 0eaf70783..f600e6c11 100644 --- a/lib/Doctrine/Import/Schema.php +++ b/lib/Doctrine/Import/Schema.php @@ -138,8 +138,11 @@ class Doctrine_Import_Schema $columns = $properties['columns']; foreach ($relations as $alias => $relation) { + $class = isset($relation['class']) ? $relation['class']:$alias; + $relation['foreign'] = isset($relation['foreign'])?$relation['foreign']:'id'; + $relation['foreign_alias'] = isset($relation['alias'])?$relation['alias']:null; $relation['alias'] = $alias; $relation['class'] = $class; @@ -153,20 +156,19 @@ class Doctrine_Import_Schema } } - /* // Fix the other end of the relations foreach($this->relations as $className => $relations) { foreach ($relations AS $alias => $relation) { + $newRelation = array(); $newRelation['foreign'] = $relation['local']; $newRelation['local'] = $relation['foreign']; $newRelation['class'] = $className; - $newRelation['alias'] = $className; + $newRelation['alias'] = isset($relation['foreign_alias'])?$relation['foreign_alias']:$className; $newRelation['type'] = $relation['type'] === Doctrine_Relation::ONE ? Doctrine_Relation::MANY:Doctrine_Relation::ONE; $this->relations[$relation['class']][$className] = $newRelation; } } - */ } } \ No newline at end of file