From 3f3103a195d288434efa0d4a1251df51a196c75c Mon Sep 17 00:00:00 2001 From: dbrewer Date: Thu, 8 Nov 2007 22:35:55 +0000 Subject: [PATCH] Fixed #587: added 'removeRecord()' method to Doctrine_Table, which is called in Doctrine_Connection_UnitOfWork->delete(). --- lib/Doctrine/Connection/UnitOfWork.php | 2 ++ lib/Doctrine/Table.php | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/Doctrine/Connection/UnitOfWork.php b/lib/Doctrine/Connection/UnitOfWork.php index 109c0219c..db20cf27f 100644 --- a/lib/Doctrine/Connection/UnitOfWork.php +++ b/lib/Doctrine/Connection/UnitOfWork.php @@ -290,6 +290,8 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module $record->getTable()->getRecordListener()->postDelete($event); $record->postDelete($event); + + $record->getTable()->removeRecord($record); $this->conn->commit(); diff --git a/lib/Doctrine/Table.php b/lib/Doctrine/Table.php index f507df71f..b78476510 100644 --- a/lib/Doctrine/Table.php +++ b/lib/Doctrine/Table.php @@ -1049,6 +1049,26 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable return true; } + /** + * removeRecord + * removes a record from the identity map, returning true if the record + * was found and removed and false if the record wasn't found. + * + * @param Doctrine_Record $record record to be removed + * @return boolean + */ + public function removeRecord(Doctrine_Record $record) + { + $id = implode(' ', $record->identifier()); + + if (isset($this->_identityMap[$id])) { + unset($this->_identityMap[$id]); + return true; + } + + return false; + } + /** * getRecord * first checks if record exists in identityMap, if not