mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
EntityManagerDecorator's repositories use EntityManager #5123
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 @anton-kotik on GitHub (May 11, 2016).
Repositories created by
Doctrine\ORM\Decorator\EntityManagerDecoratoruseEntityManagerinstead ofEntityManagerDecorator:This behavior may be unexpected for custom repositories using decorator object.
@Majkl578 commented on GitHub (Dec 20, 2017):
Hello, I'm afraid this is not something we can fix. Since we're talking about decorator pattern, inner EM instance has no knowledge about being decorated. One possible solution would be using RepositoryFactory that is created for your decorator, not for inner EM by default.
@Isinlor commented on GitHub (Mar 28, 2018):
Just to give people reading this a well visible notice.
There is a similar issue to this one with
transactionalmethod: https://github.com/doctrine/doctrine2/issues/7161@stof commented on GitHub (Apr 27, 2018):
The difference is that #7161 can workaround it, while this one cannot
@stof commented on GitHub (Apr 27, 2018):
I think event objects will also have the inner EM (as well as any place receiving the EM from the EM itself as
$this)@Isinlor commented on GitHub (Apr 27, 2018):
Actually it does have a workaround:
@githoober commented on GitHub (May 22, 2018):
And then you find that SQLBuilder also has a wrapped entity manager instance, you fix that, only to find that all collections also have the wrapped instance embedded. In the end, there is no point in using a decorated entity manager because of that because it's impossible to make it work.
@andrews05 commented on GitHub (Sep 17, 2019):
Any workaround for getting the decorator in lifecycle callbacks?