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
When upgrading from doctrine/orm 2.19.4 to 2.19.5, a behavior changed when retrieving an entity scheduled for deletion from the database before the actual flush.
Before 2.19.5, the entity scheduled for deletion and the entity retrieved from the database were 2 different objects with the previous state in the last one, which allowed us to know what was in the entity (e.g. the parent relation in my case), now it seems to be the same object.
It seems related to this PR : #11428. If I revert the changes locally, i got back the previous behavior.
Previous behavior
Current behavior
How to reproduce
#[AsDoctrineListener(event: Events::onFlush)]
class DummyListener
{
public function onFlush(OnFlushEventArgs $eventArgs): void
{
$objectManager = $eventArgs->getObjectManager();
$uow = $objectManager->getUnitOfWork();
foreach ($uow->getScheduledEntityDeletions() as $entity) {
$originalEntity = $objectManager->getRepository($entity::class)->find($entity->getId());
dump(['Saved Entity' => $entity]);
dump(['Original Entity' => $originalEntity]);
}
}
Same result if using $uow->getOriginalEntityData($entity) instead of direct call to the database to retrieve original data.
I've seen the issue #11448, but i don't think that's exactly the same problem.
Any toughts ?
The text was updated successfully, but these errors were encountered:
AirBair
changed the title
Entity scheduled for deletion and original entity retrieved from database point on the same object sinve 2.9.5
Entity scheduled for deletion and original entity retrieved from database points on the same object since 2.9.5
May 28, 2024
AirBair
changed the title
Entity scheduled for deletion and original entity retrieved from database points on the same object since 2.9.5
Entity scheduled for deletion and original entity retrieved from database points on the same object since 2.19.5
May 28, 2024
BC Break Report
Summary
Hi Doctrine team,
When upgrading from doctrine/orm 2.19.4 to 2.19.5, a behavior changed when retrieving an entity scheduled for deletion from the database before the actual flush.
Before 2.19.5, the entity scheduled for deletion and the entity retrieved from the database were 2 different objects with the previous state in the last one, which allowed us to know what was in the entity (e.g. the parent relation in my case), now it seems to be the same object.
It seems related to this PR : #11428. If I revert the changes locally, i got back the previous behavior.
Previous behavior
Current behavior
How to reproduce
Same result if using
$uow->getOriginalEntityData($entity)
instead of direct call to the database to retrieve original data.I've seen the issue #11448, but i don't think that's exactly the same problem.
Any toughts ?
The text was updated successfully, but these errors were encountered: