Commit 05119fe7 authored by Jonathan.Wage's avatar Jonathan.Wage

Fixes for relationship building.

parent 6ee5df4a
...@@ -272,7 +272,8 @@ class Doctrine_Import_Schema ...@@ -272,7 +272,8 @@ class Doctrine_Import_Schema
$class = isset($relation['class']) ? $relation['class']:$alias; $class = isset($relation['class']) ? $relation['class']:$alias;
$relation['foreign'] = isset($relation['foreign'])?$relation['foreign']:'id'; $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine::tableize($class) . '_id';
$relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:'id';
$relation['alias'] = isset($relation['alias']) ? $relation['alias'] : $alias; $relation['alias'] = isset($relation['alias']) ? $relation['alias'] : $alias;
$relation['class'] = $class; $relation['class'] = $class;
...@@ -287,8 +288,8 @@ class Doctrine_Import_Schema ...@@ -287,8 +288,8 @@ class Doctrine_Import_Schema
} }
if(isset($relation['refClass']) && !empty($relation['refClass']) && (!isset($array[$relation['refClass']]['relations']) || empty($array[$relation['refClass']]['relations']))) { if(isset($relation['refClass']) && !empty($relation['refClass']) && (!isset($array[$relation['refClass']]['relations']) || empty($array[$relation['refClass']]['relations']))) {
$array[$relation['refClass']]['relations'][$className] = array('local'=>$relation['local'],'foreign'=>$relation['foreign'],'ignore'=>true); $array[$relation['refClass']]['relations'][$className] = array('local' => $relation['local'], 'foreign' => $relation['foreign'], 'ignore' => true);
$array[$relation['refClass']]['relations'][$relation['class']] = array('local'=>$relation['local'],'foreign'=>$relation['foreign'],'ignore'=>true); $array[$relation['refClass']]['relations'][$relation['class']] = array('local' => $relation['local'], 'foreign' => $relation['foreign'], 'ignore' => true);
if(isset($relation['foreignAlias'])) { if(isset($relation['foreignAlias'])) {
$array[$relation['class']]['relations'][$relation['foreignAlias']] = array('type'=>$relation['type'],'local'=>$relation['foreign'],'foreign'=>$relation['local'],'refClass'=>$relation['refClass'],'class'=>$className); $array[$relation['class']]['relations'][$relation['foreignAlias']] = array('type'=>$relation['type'],'local'=>$relation['foreign'],'foreign'=>$relation['local'],'refClass'=>$relation['refClass'],'class'=>$className);
...@@ -337,7 +338,7 @@ class Doctrine_Import_Schema ...@@ -337,7 +338,7 @@ class Doctrine_Import_Schema
} }
} }
$this->relations[$relation['class']][$className] = $newRelation; $this->relations[$relation['class']][$newRelation['alias']] = $newRelation;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment