1
0
mirror of synced 2025-01-18 06:21:40 +03:00

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

This commit is contained in:
jackbravo 2007-09-04 01:23:02 +00:00
parent 1c5162eed2
commit c3b9837c12
2 changed files with 16 additions and 1 deletions

View File

@ -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;
}

View File

@ -682,6 +682,17 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
}
}
/**
* clearRelated
* unsets all the relationships this object has
*
* (references to related objects still remain on Table objects)
*/
public function clearRelated()
{
$this->_references = array();
}
/**
* getTable
* returns the table object for this record