mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2994: [GH-959] Implemented an ObjectPersisterInterface for entity/object storage #3719
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 (Feb 21, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of iltar:
Url: https://github.com/doctrine/doctrine2/pull/959
Message:
Why is this useful?
Instead of using the
repositoryClass, we use 'Repository as a Service'. This means that we inject our repository service instead of doing$em->getRepository('MyEntity'), this provides typehinting and autocomplete in IDEs. This introduces a minor inconvenience, we need to inject anEntityManagerInterfaceto provide persist/flush. We don't want the entireEntityManagerInterfacecapabilities just to store an object.Using the
ObjectPersisterInterfacewe can "hide" theEntityManagerInterfaceand only let the code know we have the persist and flush methods available. By default this is implemented on theEntityManager, but is also possible to be mocked or replaced by a custom implementation (rotating entity managers?).@doctrinebot commented on GitHub (Feb 21, 2014):
@doctrinebot commented on GitHub (Feb 21, 2014):
Comment created by @doctrinebot:
A related Github Pull-Request [GH-959] was closed:
https://github.com/doctrine/doctrine2/pull/959
@doctrinebot commented on GitHub (Feb 21, 2014):
Issue was closed with resolution "Duplicate"