From a7b48e4269e23b520b5a867d1b947e11153e9fdf Mon Sep 17 00:00:00 2001 From: jackbravo Date: Tue, 4 Sep 2007 01:23:11 +0000 Subject: [PATCH] Use FETCH_ARRAY on Doctrine_Record::refresh() to avoid clearing object relations --- lib/Doctrine/Record.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index 43f87321d..aca821e21 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -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();