You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way ZfcUser 3 works with events is seriously broken:
Not all objects register themselves correctly to the SharedEventManager. All services should implement EventManagerAwareInterface in order for Zend\Mvc to inject it propertly (plus: there is a bug in the EventProvider that comes bundled: Fix broken event system #677).
A lot of services attach and trigger events in their constructor. That has two problems:
They are not usuable. See RegisterFilter. The only way to use it would normally be the shared manager. However that is in ZF3 only injected after construction using an initializer.
They are overwritten. There is some business logic dependent on it in AdapterChainServiceFactory. If we were to properly mark the AdapterClass as a EventManagerAwareInterface capable service, the event manager would be overwritten directly after construction (again via the bundled Initializer of ZF3 in Mvc). And thus the adapters will never receive the authenticate event.
The way events are triggered in AdapterChain is super weird. And is different from how it worked under ZF2. The event is passed as the $target parameter! What we need to do is use the triggerEvent method of the EventManager.
The way ZfcUser 3 works with events is seriously broken:
SharedEventManager. All services should implementEventManagerAwareInterfacein order forZend\Mvcto inject it propertly (plus: there is a bug in theEventProviderthat comes bundled: Fix broken event system #677).RegisterFilter. The only way to use it would normally be the shared manager. However that is in ZF3 only injected after construction using an initializer.AdapterChainServiceFactory. If we were to properly mark theAdapterClassas aEventManagerAwareInterfacecapable service, the event manager would be overwritten directly after construction (again via the bundled Initializer of ZF3 in Mvc). And thus the adapters will never receive theauthenticateevent.AdapterChainis super weird. And is different from how it worked under ZF2. The event is passed as the$targetparameter! What we need to do is use thetriggerEventmethod of theEventManager.I have a PR that fixes all of this. See #677