php - Optimistic lock in Doctrine2 doesn't work for many to many relation -
i have entity user
has many many relation roles. i've tried implement optimistic lock, works fine, when changed roles, doesn't alter version (user entity version), proper behaviour?
class user { /** * user's roles. * * @orm\manytomany(targetentity="role") */ private $roles; ...
doctrine 2's locking mechanisms don't take associations account. protect against changes entities themselves. imho expected, because has no way know associations include , ignore. isn't you'd want happen blindly on associations.
theoretically doctrine 2 accomplish adding alternative association mappings, @ moment isn't supported.
so have 2 options:
try implement such feature, , submit pr :) implement own optimistic locking mechanism take specific association account. php concurrency doctrine2 optimistic-locking optimistic-concurrency
No comments:
Post a Comment