mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
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/8508
State: closed
Merged: Yes
Changed lock function to compare timestamps instead of DateTimeInterface objects directly.
When using optimistic lock with DateTimeInterface based version field a bug appears due to the use of the === operator for comparing the lock version and the entity version. This comparison always resolves to false because the === operator when comparing objects is only true when both sides are the exact same instance of the object.
To fix the issue I have decided to compare timestamps instead the DateTimeInterface based objects directly, calling getTimestamp() method and doing a strict comparison.
Modified OptimisticLockException to use DateTimeInterface instead of DateTime class.
Added test suite to cover case.
Fixes #8499