mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Allow Entity Listener to match interface #6452
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hermann8u on GitHub (Apr 21, 2020).
Feature Request
Summary
Hi,
There is a drawback using lifecycle listeners because they are called for every entities. On the other hand, entity listener can be applied only on one entity, limiting the number of calls, but not on interfaces.
Most of the time, when we use lifecycle listeners, the goal is to match an interface. That's why it will be great to have the possibility to use entity listeners mapped with an interface instead.
As a reference, here is a post on the same subject: https://dev.to/c33s/doctrine-simple-event-listener-are-not-interface-compatible-ioj
@greg0ire commented on GitHub (Apr 21, 2020):
Possible next step: find the PR that introduced that feature, and see if this has already been discussed.
@hermann8u commented on GitHub (Apr 21, 2020):
Yeah I tried to find isues and PR discuting about this (maybe not enought?). It's difficult to find something in more than 1100 issues and 250 PR though :/
So I guess there is something in that direction? Can I close this one?
@greg0ire commented on GitHub (Apr 21, 2020):
Uuuh no? Since you did not find anything
Well, no, why would you close it?
It is, that's why you should use the git log instead. The first step would be to use
git log -S EntityListenerOrWhateverThisIsCalledto find the first commit that introduces it.@SimonVanacco commented on GitHub (Jan 5, 2023):
I think this would be a huge QoL improvement to EntityListeners, is there any way to help achieve this ?
@derrabus commented on GitHub (Jan 6, 2023):
Create a PR that implements this feature.
@janklan commented on GitHub (Mar 23, 2023):
@SimonVanacco Implement a life cycle listener and ignore all events not related to the interface of your interest. That's what I did, anyway.