diff --git a/EventListener/ORM/Aggregate/AggregatePartListener.php b/EventListener/ORM/Aggregate/AggregatePartListener.php index 75af834..018836e 100644 --- a/EventListener/ORM/Aggregate/AggregatePartListener.php +++ b/EventListener/ORM/Aggregate/AggregatePartListener.php @@ -51,8 +51,10 @@ public function onFlush(OnFlushEventArgs $eventArgs): void } foreach ($this->aggregateRoots as $aggregateRoot) { - $aggregateRoot->setUpdatedAt($this->dateTimeHelper->getCurrentDatetime()); - $uow->recomputeSingleEntityChangeSet($em->getClassMetadata(\get_class($aggregateRoot)), $aggregateRoot); + if (!$uow->isScheduledForDelete($aggregateRoot)) { + $aggregateRoot->setUpdatedAt($this->dateTimeHelper->getCurrentDatetime()); + $uow->recomputeSingleEntityChangeSet($em->getClassMetadata(\get_class($aggregateRoot)), $aggregateRoot); + } } $this->aggregateRoots = [];