mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #9531] Allow custom repository implementations to skip EntityRepository #11682
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?
Original Pull Request: https://github.com/doctrine/orm/pull/9531
State: closed
Merged: No
This change might be controversial.
Currently, the ORM requires repositories to be implementations of the generic
ObjectRepositoryinterface only. The ORM's ownEntityRepositoryclass is the default and can be used as base class for custom implementations, but we don't have to use it.On the other hand,
EntityManagerInterface::getRepository()promises to always return aEntityRepository. This works fine now, but will fail if we migrate to native return types.This PR widens all return types to hint at the more generic
ObjectRepositoryinterface. It also adds a functional test that makes sure, genericObjectRepositoryimplementations can be used.However, I'm unsure if using generic
ObjectRepositoryimplementations is a case that we actually want to support. The alternative could be to deprecate not using anEntityRepositorysub-class and trigger an error on 3.0.