mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
static method on EntityManager makes impossible to override entityManager class #5312
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 @wolfwolker on GitHub (Nov 4, 2016).
Originally assigned to: @Ocramius on GitHub.
the last line of this method is return new EntityManager(...), so if you try to override this class you need to copy/paste the whole method for only this purpose. This is mentioned here http://stackoverflow.com/questions/8138962/is-there-a-way-to-specify-doctrine2-entitymanager-implementation-class-in-symfon and in some other sOverflow's topic
I think a solution could be end this method with return new static(...) instead.
Sorry if this topic is duplicated, I wasn't able to found it either in issues nor pr section.
@Ocramius commented on GitHub (Nov 4, 2016):
You should either use an EntityManagerDecorator, or re-implement the
EntityManagerInterface.
On 4 Nov 2016 12:14, "Noel Garcia" notifications@github.com wrote: