Browse Source

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.
mark_story 14 years ago
parent
commit
cbd6cafed7
1 changed files with 3 additions and 1 deletions
  1. 3 1
      lib/Cake/View/View.php

+ 3 - 1
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;
 		}