You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@alcaeus do you remember the reason why we're casting values to anything instead of relying on $dbOrgValue == $dbActualValue?
Off the top of my head, no.
The code should be [...]
While casting to string will indeed give us a string with millisecond precision, this shouldn't be necessary and comparing the UTCDateTime instances directly is the way to go as the class implements a compare handler. @olivier34000 if you'd like, you can create a PR (ideally with a failing test case) to change this. No need to cast to milliseconds, just comparing $dbOrgValue == $dbActualValue should be sufficient. Just keep in mind to use a loose comparison, as a strict comparison (===) will always return false as the variables don't contain the same object instance.
BC Break Report
Summary
When we have a field with the type date if the field is updated in less than 1 second the update does not work correctly. The field is not updated
Previous behavior
In this previous version when the field was a date we compared 2 MongoDate
https://github.com/doctrine/mongodb-odm/blob/1.3.x/lib/Doctrine/ODM/MongoDB/UnitOfWork.php#L816-L823
In the MongoDate object we have a timestamp and the miliseconds.
In the new version we have https://github.com/doctrine/mongodb-odm/blob/2.6.x/lib/Doctrine/ODM/MongoDB/UnitOfWork.php#L798-L809
The UTCDateTime object contains also the milliseconds but we loose this information in the changeSet.
Is-it possible to only cast the UTCDateTime in string in order to keep this information ?
The code should be
The text was updated successfully, but these errors were encountered: