From 763e5eef0e9a7a4025fa13e24bbc0089784b70e4 Mon Sep 17 00:00:00 2001 From: Olmo Maldonado Date: Wed, 5 May 2010 07:00:50 +0800 Subject: [PATCH] Adding a after and before event for dropped collections. --- lib/ActiveMongo.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ActiveMongo.php b/lib/ActiveMongo.php index a49bfed..5372b4e 100644 --- a/lib/ActiveMongo.php +++ b/lib/ActiveMongo.php @@ -551,10 +551,12 @@ abstract class ActiveMongo implements Iterator, Countable, ArrayAccess case 'before_update': case 'before_validate': case 'before_delete': + case 'before_drop': case 'after_create': case 'after_update': case 'after_validate': case 'after_delete': + case 'after_drop': $fnc = array($this, $event); $params = "events_params"; if (is_callable($fnc)) { @@ -809,7 +811,11 @@ abstract class ActiveMongo implements Iterator, Countable, ArrayAccess return false; } $obj = new $class; - return $obj->_getCollection()->drop(); + $obj->triggerEvent('before_drop'); + $result = $obj->_getCollection()->drop(); + $obj->triggerEvent('after_drop'); + return $result; + } // }}} -- 2.11.4.GIT