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);
|
$this->_tables[$component]->setData($data);
|
||||||
$record = $this->_tables[$component]->getRecord();
|
$record = $this->_tables[$component]->getRecord();
|
||||||
$this->_records[] = $record;
|
|
||||||
|
if ( ! isset($this->_records[$record->getOid()]) ) {
|
||||||
|
$record->clearRelated();
|
||||||
|
$this->_records[$record->getOid()] = $record;
|
||||||
|
}
|
||||||
|
|
||||||
return $record;
|
return $record;
|
||||||
}
|
}
|
||||||
|
@ -681,6 +681,17 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
|||||||
$this->_references[$name] = $rel->fetchRelatedFor($this);
|
$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
|
* getTable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user