mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Merge pull request #3246 from cakephp/2.5-event
Make dispatch return CakeEvent - resolves #2819
This commit is contained in:
commit
2dd57c7191
1 changed files with 3 additions and 2 deletions
|
@ -222,7 +222,7 @@ class CakeEventManager {
|
||||||
* Dispatches a new event to all configured listeners
|
* Dispatches a new event to all configured listeners
|
||||||
*
|
*
|
||||||
* @param string|CakeEvent $event the event key name or instance of CakeEvent
|
* @param string|CakeEvent $event the event key name or instance of CakeEvent
|
||||||
* @return void
|
* @return CakeEvent
|
||||||
*/
|
*/
|
||||||
public function dispatch($event) {
|
public function dispatch($event) {
|
||||||
if (is_string($event)) {
|
if (is_string($event)) {
|
||||||
|
@ -231,7 +231,7 @@ class CakeEventManager {
|
||||||
|
|
||||||
$listeners = $this->listeners($event->name());
|
$listeners = $this->listeners($event->name());
|
||||||
if (empty($listeners)) {
|
if (empty($listeners)) {
|
||||||
return;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($listeners as $listener) {
|
foreach ($listeners as $listener) {
|
||||||
|
@ -250,6 +250,7 @@ class CakeEventManager {
|
||||||
$event->result = $result;
|
$event->result = $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue