diff --git a/lib/Doctrine/Connection.php b/lib/Doctrine/Connection.php index 2b0337859..276f89e73 100644 --- a/lib/Doctrine/Connection.php +++ b/lib/Doctrine/Connection.php @@ -976,11 +976,15 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function close() { - $this->getAttribute(Doctrine::ATTR_LISTENER)->onPreClose($this); + $event = new Doctrine_Event($this, Doctrine_Event::CONN_CLOSE); + + $this->getAttribute(Doctrine::ATTR_LISTENER)->preClose($event); $this->clear(); + + $this->dbh = null; - $this->getAttribute(Doctrine::ATTR_LISTENER)->onClose($this); + $this->getAttribute(Doctrine::ATTR_LISTENER)->postClose($event); } /** * get the current transaction nesting level diff --git a/lib/Doctrine/Event.php b/lib/Doctrine/Event.php index 7418a8100..5c0928808 100644 --- a/lib/Doctrine/Event.php +++ b/lib/Doctrine/Event.php @@ -38,6 +38,7 @@ class Doctrine_Event const CONN_EXEC = 2; const CONN_PREPARE = 3; const CONN_CONNECT = 4; + const CONN_CLOSE = 5; const STMT_EXECUTE = 10; const STMT_FETCH = 11; diff --git a/lib/Doctrine/EventListener.php b/lib/Doctrine/EventListener.php index 1d6b9d95c..a1a7ca67b 100644 --- a/lib/Doctrine/EventListener.php +++ b/lib/Doctrine/EventListener.php @@ -50,9 +50,9 @@ class Doctrine_EventListener implements Doctrine_EventListener_Interface public function onPreEvict(Doctrine_Record $record) { } - public function onClose(Doctrine_Event $event) + public function preClose(Doctrine_Event $event) { } - public function onPreClose(Doctrine_Event $event) + public function postClose(Doctrine_Event $event) { } public function onCollectionDelete(Doctrine_Collection $collection)