A couple weeks ago I started working on a new event manager for ZF3 with the idea to delegate the handling of an event to the event class itself by utilizing the event's __invoke method. This offers a bit more flexibility and allows further decoupling from the listeners iterator (EM).
Each Listener has a corresponding Event, and vice versa, and some of them may only be able to invoke their counterpart event or listener. For those specific listeners, it is possible to change that listeners __invoke method to specify the exact arguments that the listener needs; the event object will invoke the listener accordingly.
Additionally, traits also offer a means to for listeners to alias the __invoke method and call it with specific arguments (i.e. not just with the event object).
Grouping of convenience method for services was also nicely handled by traits and each component has a ServicesTrait that provides the convenience methods available for that component.
The event manager code is pretty lean and performs well. The event manager is now a Priority Queue Listener which stores the listeners in an array for quicker access and only returns a priority queue iterator when asked to find the listeners for a given event.
There is also a consistent organization and naming/file convention which should be fairly easy to use and follow (remember each event and listener can specify their own __invoke signature).
I would love to get feed back, good or bad; especially on expanding the specific method signatures to factories classes. Another related thought is having the RouteMatch also represent a Controller\Event that could be specific for invoking that controller.
Happy New Year!
while I first had some concerns about this, I took a deeper look into your source code and it looks pretty straightforward.
Good job, thanks, and a happy new year!
2013/12/30 Greg <[hidden email]>
Thanks Sascha, there's a Skeleton App with a modified config file and controller https://github.com/devosc/ZendSkeletonApplication
On Mon, Dec 30, 2013 at 3:52 PM, Sascha-Oliver Prolic <[hidden email]> wrote:
|Free forum by Nabble||Edit this page|