From cbd6cafed7936c369e670ed3f7b0e02bbc4d596b Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 14 May 2012 21:18:09 -0400 Subject: [PATCH] The event manager should be re-used. View::__construct() gets the controller's event manager, only to override it the first time getEventManager() is called. Don't overwrite the Controller's event manager as it allows plugins to more easily hook into the view process. --- lib/Cake/View/View.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index 1078211ae..f2e40eac5 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -332,8 +332,10 @@ class View extends Object { * @return CakeEventManager */ public function getEventManager() { - if (empty($this->_eventManager) || !$this->_eventManagerConfigured) { + if (empty($this->_eventManager)) { $this->_eventManager = new CakeEventManager(); + } + if (!$this->_eventManagerConfigured) { $this->_eventManager->attach($this->Helpers); $this->_eventManagerConfigured = true; }