Skip to content

Event system ZfcUser 3 seriously broken #678

@roelvanduijnhoven

Description

@roelvanduijnhoven

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.

I have a PR that fixes all of this. See #677

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions