Commit c3b9837c authored by jackbravo's avatar jackbravo

Fix bug #428, clearing object relations before adding new ones in a query

parent 1c5162ee
......@@ -101,7 +101,11 @@ class Doctrine_Hydrate_Record extends Doctrine_Object
}
$this->_tables[$component]->setData($data);
$record = $this->_tables[$component]->getRecord();
$this->_records[] = $record;
if ( ! isset($this->_records[$record->getOid()]) ) {
$record->clearRelated();
$this->_records[$record->getOid()] = $record;
}
return $record;
}
......
......@@ -681,6 +681,17 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
$this->_references[$name] = $rel->fetchRelatedFor($this);
}
}
/**
* clearRelated
* unsets all the relationships this object has
*
* (references to related objects still remain on Table objects)
*/
public function clearRelated()
{
$this->_references = array();
}
/**
* getTable
......
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