Fix bug #428, clearing object relations before adding new ones in a query
This commit is contained in:
parent
1c5162eed2
commit
c3b9837c12
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user