mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2156: [regression] EntityManager::find() doesn't call custom repository anymore #2712
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 @doctrinebot on GitHub (Nov 19, 2012).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user literal:
Up to version 2.2 the entity manager would forward calls to
find()to the respective repositories. In 2.3 the entity manager handles these calls directly.This interferes with custom repositories that have an overridden
find()method.It's inconsistent, because
$em->getRepository('Foo')->find($id)may do something different to$em ->find('Foo', $id)now.Not sure if this is intentional. If it is, it's missing in the change log and the docs (7.8.1. "Essentially, EntityManager#find() is just a shortcut for the following...").
In any case it's a big BC issue for us:
find()to throw (also generated) custom exceptions when an entity isn't found. We just don't want all thosenullchecks in the client code, especially as we'd sooner or later forget one somewhere.$em->find('Foo', $id)style everywhere because it's more concise - it doesn't seem to make much sense to explicitly fetch the repository when this could be done implicitly.