1
0
mirror of synced 2025-01-17 22:11:41 +03:00

Use FETCH_ARRAY on Doctrine_Record::refresh() to avoid clearing object relations

This commit is contained in:
jackbravo 2007-09-04 01:23:11 +00:00
parent c3b9837c12
commit a7b48e4269

View File

@ -642,16 +642,15 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
}
$id = array_values($id);
$records = Doctrine_Query::create()
->from($this->_table->getComponentName())
->where(implode(' = ? AND ', $this->_table->getPrimaryKeys()) . ' = ?')
->execute($id);
// Use FETCH_ARRAY to avoid clearing object relations
$record = $this->getTable()->find($id, Doctrine::FETCH_ARRAY);
if (count($records) === 0) {
if ($record === false) {
throw new Doctrine_Record_Exception('Failed to refresh. Record does not exist.');
}
$this->hydrate($record);
$this->_modified = array();
$this->prepareIdentifiers();