I'm wondering if anyone else has come across this: I have a situation in
which I'm dispatching an event with 2.1's event system, and have
multiple listeners for that event. Each listener returns its own set of
data, with the idea being that all of the returned data is compiled into
one set (in this case, it's for displaying admin navigation in a CMS).
However, it seems that CakeEventManager overwrites the return data in
each iteration of the loop over the listeners:
foreach ($this->listeners($event->name()) as $listener) {
...
if ($listener['passParams'] === true) {
$result = call_user_func_array($listener['callable'],
$event->data);
} else {
$result = call_user_func($listener['callable'], $event);
}
...
if ($result !== null) {
$event->result = $result;
}
continue;
}
I would expect $event->result to be a multidimensional array, but nope,
it just gets overwritten. Has anyone else come across this issue? Am I
just missing a really obvious way to get data from multiple listeners
for the same event?
- Jamie
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php