Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Always load Doctrine listeners lazily #27661

Closed
@weaverryan

Description

@weaverryan

Description
Currently, Doctrine event listeners are instantiated in order to create the Doctrine event manager. You can fix this by adding a lazy=true option to your service (this feature was added 6+ years ago). Could we just always make this lazy? This would solve issues during cache building, where all of the listeners are instantiated.

Relevant code:

if ($lazy = !empty($tag['lazy'])) {
$taggedListenerDef->setPublic(true);
}

Especially if we refactored the ContainerAwareEventManager to accept a service locator (instead of the entire container), this would be an easy win: we wouldn't even need to make the original definitions public anymore (which is the only downside).

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