mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
getId() lazy load entity if getId() is in trait #5263
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 @steevanb on GitHub (Sep 19, 2016).
Originally assigned to: @Ocramius on GitHub.
Hi !
If i use a trait to define getId(), instead of directly define it in class, Doctrine will trigger an useless lazy load.
Here is a test case with 3 simples entities :
Now, try to call Comment::getId() and CommentWithTrait::getId() :
Thanks !
@steevanb commented on GitHub (Oct 31, 2016):
Nobody's here ?
@Ocramius commented on GitHub (Oct 31, 2016):
This is a known bug - https://github.com/doctrine/common/pull/337
See https://github.com/doctrine/doctrine2/pull/1241
@steevanb commented on GitHub (Oct 31, 2016):
Why can't you fix it ?
@Ocramius commented on GitHub (Oct 31, 2016):
Mostly because reflection+traits is a mess. It might be fixed by replacing
proxying library support with ProxyManager though
On 31 Oct 2016 12:40, "Steevan BARBOYON" notifications@github.com wrote:
@Metabor commented on GitHub (Jul 10, 2019):
For me the easiest workaround was to make getId() method in trait final, so that the proxy class will not overwrite the original code.
@Ocramius commented on GitHub (Jul 10, 2019):
This is already fixed in
3.x-dev@Metabor commented on GitHub (Jul 10, 2019):
Good to hear this. So I am happy that I can remove my workaround after this fix is in a release version.