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
In the current version of this package the EntityListenerResolver memory caches instances of resolved listeners. This overrides the current behavior of the Laravel container. For example if a develop defines a listener as a factory (bind in Laravel) then it's turned into a singleton via this resolver. This breaks the container definition and forces developers to treat listeners as singletons. Where performance is an issue a developer can still define the listener as a singleton in container via singleton method in the container. Which also means that these checks at https://github.com/laravel-doctrine/orm/blob/1.4/src/Resolvers/EntityListenerResolver.php#L51 are a duplication of what already happens in the make method of the container.
For these reasons my proposal is that the resolve method of the listener be simplified to not cache instances created by the containers make method. It should still check to see if there is an instance in instances property for listeners that have been registered via register method.
The text was updated successfully, but these errors were encountered:
In the current version of this package the
EntityListenerResolver
memory caches instances of resolved listeners. This overrides the current behavior of the Laravel container. For example if a develop defines a listener as a factory (bind
in Laravel) then it's turned into a singleton via this resolver. This breaks the container definition and forces developers to treat listeners as singletons. Where performance is an issue a developer can still define the listener as a singleton in container viasingleton
method in the container. Which also means that these checks at https://github.com/laravel-doctrine/orm/blob/1.4/src/Resolvers/EntityListenerResolver.php#L51 are a duplication of what already happens in themake
method of the container.For these reasons my proposal is that the
resolve
method of the listener be simplified to not cache instances created by the containersmake
method. It should still check to see if there is an instance ininstances
property for listeners that have been registered viaregister
method.The text was updated successfully, but these errors were encountered: