Imagine the following situation:
You have several event handlers defined as services. These event handlers
need to have several other services injected into them (say you have an
invokable EmailUserOnNewAccountCreatedEventHandler that requires a Zend_Mail
instance and a Zend_Db instance).

Now in order to attach these handlers to your EventManger instance (which
could itself be a service and have attaching made through Di) you will need
to instantiate all of them (you cannot pass just the class name because the
CallbackHandler object will not know to inject your dependencies). This is
obviously bad, because instantiating them will in turn instantiate their all
dependencies.

The above is actually the only scenario i am using the new ZF2 EventManager
for right now.

So the EventManager needs to handle these situations correctly, be Di
enabled, and lazy load the handler instances. If by any chance this is
already possible, please let me know how i can achieve it.

Thank you,
Alex

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-Di-EventManager-tp4485022p4485022.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to