orourkedd
orourkedd

Reputation: 6421

Zend 2 Event Listeners in classes not loaded

Does the Zend 2 event manager have the ability to fire listeners in classes that are not loaded?

Upvotes: 0

Views: 263

Answers (1)

David Weinraub
David Weinraub

Reputation: 14184

If I understand you correctly, then I believe that you can register listeners using the StaticEventManager (see Event Manager Quick Start).

In this case, you do not need to have an instance of the target class (just the name), but you can register listeners for events (typically methods) on future instances of that target class that may occur.

Of course, in order to be useful, the target class should actually compose an EventManager instance (probably via an events() method, as described on the same Quick Start page) and actually fire the events.

I confess that I am still trying to wrap my own head around the ZF2 EventManager, so if I have totally boned it up here, please feel free to correct me.

Upvotes: 1

Related Questions