From 1f7afc1685185f1762cf809ebc7fb73d2e008c58 Mon Sep 17 00:00:00 2001 From: Olmo Maldonado Date: Sun, 2 May 2010 00:03:01 +0800 Subject: [PATCH] For after_delete is not triggered. --- lib/ActiveMongo.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ActiveMongo.php b/lib/ActiveMongo.php index 63311f5..a49bfed 100644 --- a/lib/ActiveMongo.php +++ b/lib/ActiveMongo.php @@ -735,8 +735,9 @@ abstract class ActiveMongo implements Iterator, Countable, ArrayAccess */ final function delete() { + + $document = array('_id' => $this->_id); if ($this->_cursor InstanceOf MongoCursor) { - $document = array('_id' => $this->_id); $this->triggerEvent('before_delete', array($document)); $result = $this->_getCollection()->remove($document); $this->triggerEvent('after_delete', array($document)); @@ -746,7 +747,9 @@ abstract class ActiveMongo implements Iterator, Countable, ArrayAccess $criteria = (array) $this->_query['query']; /* remove */ + $this->triggerEvent('before_delete', array($document)); $this->_getCollection()->remove($criteria); + $this->triggerEvent('after_delete', array($document)); /* reset object */ $this->reset(); -- 2.11.4.GIT