Skip to content
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...
markstory committed May 15, 2012
1 parent 8103eae commit cbd6cafed7936c369e670ed3f7b0e02bbc4d596b
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Cake/View/View.php
@@ -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.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.