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.
This commit is contained in:
mark_story 2012-05-14 21:18:09 -04:00
parent 8103eae9f1
commit cbd6cafed7

View file

@ -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;
}