Commit abcc423f authored by zYne's avatar zYne

new relation parser now supports many-to-many relations

parent 4f57aac3
...@@ -136,7 +136,8 @@ class Doctrine_Relation_Parser ...@@ -136,7 +136,8 @@ class Doctrine_Relation_Parser
$def['refTable']->getRelationParser()->bind($this->_table->getComponentName(), $def['refTable']->getRelationParser()->bind($this->_table->getComponentName(),
array('type' => Doctrine_Relation::ONE)); array('type' => Doctrine_Relation::ONE));
$this->bind($def['refClass'], array('type' => Doctrine_Relation::MANY)); $this->bind($def['refClass'], array('type' => Doctrine_Relation::MANY,
'foreign' => $def['local']));
} }
if (in_array($def['class'], $localClasses)) { if (in_array($def['class'], $localClasses)) {
return new Doctrine_Relation_Association_Self($def); return new Doctrine_Relation_Association_Self($def);
...@@ -206,7 +207,14 @@ class Doctrine_Relation_Parser ...@@ -206,7 +207,14 @@ class Doctrine_Relation_Parser
return $columns; return $columns;
} }
public function guessColumns($classes, Doctrine_Table $foreignTable) /**
* guessColumns
*
* @param array $classes an array of class names
* @param Doctrine_Table $foreignTable foreign table object
* @return array an array of column names
*/
public function guessColumns(array $classes, Doctrine_Table $foreignTable)
{ {
$conn = $this->_table->getConnection(); $conn = $this->_table->getConnection();
...@@ -304,7 +312,7 @@ class Doctrine_Relation_Parser ...@@ -304,7 +312,7 @@ class Doctrine_Relation_Parser
} }
} }
throw new Relation_Parser_Exception("Couldn't complete relation definition."); throw new Doctrine_Relation_Parser_Exception("Couldn't complete relation definition.");
} }
} }
return $def; return $def;
......
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