mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Versioned Embeddable will not propagate version to Entity #5206
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 @tPl0ch on GitHub (Jul 30, 2016).
Hi guys,
we are currently doing a refactoring of our code base and we are building a service that expects multiple clients to call the API, hence we wanted to explicitly model the concurrency control in our domain. One of our Repository implementations uses the Doctrine ORM for data access.
Since the version is part of an Entity's identity, we have created a
CountryIdvalue object that includes the current version. See the XML mapping below:We then use this as an
Embeddableinside theCountryentity:In our Repository implementation we then use the Version from the
CountryIdto call theEntityManagerwithLockMode::OPTIMISTIC. As a side note, we are injecting an instance ofEntityManagerInterfacein our repository which actually has no knowledge of the locking parameters. IMO there should be anLockableEntityManagerInterfacethat defines afindWithLock($className, $id, $lockMode, $version):My expectation was that the version definition from the embeddable
CountryIdwould propagate into theCountryentity, but apparently I was wrong:I would be up for adding this kind of propagation to the Metadata drivers since I don't want to maintain (another) fork of a library in our dependecies. The question is do you think this feature has a chance of being merged into the upstream? If so, I'd happily provide a patch with test cases.
Regards
Thomas
@DHager commented on GitHub (Aug 31, 2016):
From my experience with #1456, expect a long wait.