Custom event object

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Custom event object

Norbert Máté
Hi everyone,
   as I know in zf2 you can extend the Event class or create a custom event
class and then you can trigger this custom event.

I am thinking about creating custom event classes for each module where I
would add constants for the event names the module can trigger. My problem
with this is that this creates dependency between modules because I would
use the constants in other modules to catch the events. But if I don't use
constants than when triggering an event should I use simple strings
('myEvent')?

I think if every module would have a class (custom event) where I would put
all the event names that the module can trigger would be easier to track
the events.
What is your opinion about this?

Do you know any other uses cases for custom events?

Regards,
Norbert.