mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Check event against listeners registered in local and global manager
Closes #2730
This commit is contained in:
parent
35c22a291e
commit
9f978e9bf7
1 changed files with 5 additions and 3 deletions
|
@ -259,16 +259,18 @@ class CakeEventManager {
|
|||
* @return array
|
||||
*/
|
||||
public function listeners($eventKey) {
|
||||
$globalListeners = array();
|
||||
if (!$this->_isGlobal) {
|
||||
$globalListeners = self::instance()->prioritisedListeners($eventKey);
|
||||
} else {
|
||||
$globalListeners = $this->prioritisedListeners($eventKey);
|
||||
}
|
||||
$listeners = array_merge($this->_listeners, self::instance()->_listeners);
|
||||
|
||||
if (empty($this->_listeners[$eventKey]) && empty($globalListeners)) {
|
||||
if (empty($listeners[$eventKey]) && empty($globalListeners)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$listeners = $this->_listeners[$eventKey];
|
||||
$listeners = $listeners[$eventKey];
|
||||
foreach ($globalListeners as $priority => $priorityQ) {
|
||||
if (!empty($listeners[$priority])) {
|
||||
$listeners[$priority] = array_merge($priorityQ, $listeners[$priority]);
|
||||
|
|
Loading…
Reference in a new issue