Commit 5bec1b22 authored by Jonathan.Wage's avatar Jonathan.Wage

Fix for class/alias relation generation.

parent 3b0f749a
...@@ -208,7 +208,8 @@ END; ...@@ -208,7 +208,8 @@ END;
} }
foreach ($relations as $name => $relation) { foreach ($relations as $name => $relation) {
$alias = (isset($relation['alias']) && $relation['alias'] !== $name) ? ' as ' . $relation['alias'] : ''; $class = isset($relation['class']) ? $relation['class']:$name;
$alias = (isset($relation['alias']) && $relation['alias'] !== $relation['class']) ? ' as ' . $relation['alias'] : '';
if ( ! isset($relation['type'])) { if ( ! isset($relation['type'])) {
$relation['type'] = Doctrine_Relation::ONE; $relation['type'] = Doctrine_Relation::ONE;
...@@ -216,9 +217,9 @@ END; ...@@ -216,9 +217,9 @@ END;
if ($relation['type'] === Doctrine_Relation::ONE || if ($relation['type'] === Doctrine_Relation::ONE ||
$relation['type'] === Doctrine_Relation::ONE_COMPOSITE) { $relation['type'] === Doctrine_Relation::ONE_COMPOSITE) {
$ret[$i] = ' $this->hasOne(\'' . $name . $alias . '\''; $ret[$i] = ' $this->hasOne(\'' . $class . $alias . '\'';
} else { } else {
$ret[$i] = ' $this->hasMany(\'' . $name . $alias . '\''; $ret[$i] = ' $this->hasMany(\'' . $class . $alias . '\'';
} }
$a = array(); $a = array();
......
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