Skip to content

[BCBreak][DoctrineBridge] Listeners lazy loading is not transparent #31051

Closed
@malarzm

Description

@malarzm

Symfony version(s) affected: 4.2.5

Description
If some listeners are removed from ContainerAwareEventManager before being initialized they can not be added back if any event was dispatched in the meantime. This happens because dispatchEvent marks specific groups of events as initialized BUT addEventListener checks whether anything was intialized

Possible Solution
Maybe if a listeners is a string the container should be always checked whether it has a service defined under that name? That should allow adding lazy loaded listeners after construction. Other option might be to initialize listeners in getListeners but I don't know how it is used internally by Symfony.

Additional context
In our app we're disabling and re-enabling Doctrine events mostly to disable FosElastica events for batch operations. This is no longer possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions