Permalink
Browse files

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.
  • Loading branch information...
1 parent 8103eae commit cbd6cafed7936c369e670ed3f7b0e02bbc4d596b @markstory markstory committed May 15, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Cake/View/View.php
View
@@ -332,8 +332,10 @@ public function __construct(Controller $controller = null) {
* @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;
}

0 comments on commit cbd6caf

Please sign in to comment.