Merge pull request #3246 from cakephp/2.5-event

Make dispatch return CakeEvent - resolves #2819
This commit is contained in:
José Lorenzo Rodríguez 2014-04-06 21:51:48 +02:00
commit 2dd57c7191

View file

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