mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #869] [CLOSED] Detach (DateTime) objects in original object data #8831
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?
📋 Pull Request Information
Original PR: https://github.com/doctrine/orm/pull/869
Author: @tomphp
Created: 12/4/2013
Status: ❌ Closed
Base:
master← Head:fix/detach-datetime-objects📝 Commits (2)
e758650Detach objects in original object dataa057554Detach objects in original object data for refreshes also📊 Changes
3 files changed (+81 additions, -3 deletions)
View changed files
📝
lib/Doctrine/ORM/UnitOfWork.php(+20 -2)📝
tests/Doctrine/Tests/Models/Generic/DateTimeModel.php(+1 -1)📝
tests/Doctrine/Tests/ORM/UnitOfWorkTest.php(+60 -0)📄 Description
The PR makes Doctrine ORM update the database when you execute something like this:
The reason this doesn't work currently is because the array of original data stored in the UnitOfWork contains the actual DateTime object which is in the entity. When you update the object in the entity the original data is updated also so the entity are the original value are still equal and therefore the object is not seen as changed.
I have chosen to clone all objects rather than just DateTime object include more types are included in the future.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.