mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
getReference caches proxy #5065
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 @fabioginzel on GitHub (Mar 25, 2016).
Originally assigned to: @Ocramius on GitHub.
Example:
Always return "found" even if the entity does not exist, because it returns the cached proxy
@Ocramius commented on GitHub (Mar 25, 2016):
That's expected behavior: what kind of behavior were you expecting, and why?
@fabioginzel commented on GitHub (Mar 25, 2016):
I have expected that since $notExistsId doesnt exist it would return null
@Ocramius commented on GitHub (Mar 25, 2016):
That means that you could potentially have two instances of the same
Application\Entity\Usuarioinside yourUnitOfWork, which breaks one of the base invariants of the ORM@Ocramius commented on GitHub (Mar 25, 2016):
Note that
getReferenceshould only ever be used if you are 100% sure that the record will exist, but you do not want to load it immediately