mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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:
parent
8103eae9f1
commit
cbd6cafed7
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue