Commit a7b48e42 authored by jackbravo's avatar jackbravo

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

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