From 607fece64dc6026afa1c076242f821868ac096bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Zapletal?= Date: Sat, 28 Sep 2024 03:30:26 +0200 Subject: [PATCH] Fixed non-flushing entity properties --- src/Http/Request/Collection/CreateRequest.php | 2 ++ src/Http/Request/Collection/UpdateRequest.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Http/Request/Collection/CreateRequest.php b/src/Http/Request/Collection/CreateRequest.php index 3e1841d..597a9d5 100644 --- a/src/Http/Request/Collection/CreateRequest.php +++ b/src/Http/Request/Collection/CreateRequest.php @@ -107,6 +107,8 @@ public function process(array $data): Response try { foreach (ArrayToEntity::getEntitiesToFlush()->getIterator() as $entity) { + $classMetadata = $this->em->getClassMetadata($entity::class); + $this->em->getUnitOfWork()->recomputeSingleEntityChangeSet($classMetadata, $entity); $this->em->flush($entity); } $this->em->commit(); diff --git a/src/Http/Request/Collection/UpdateRequest.php b/src/Http/Request/Collection/UpdateRequest.php index 241aeaf..5a4963d 100644 --- a/src/Http/Request/Collection/UpdateRequest.php +++ b/src/Http/Request/Collection/UpdateRequest.php @@ -132,6 +132,8 @@ public function process(array $data): Response try { foreach (ArrayToEntity::getEntitiesToFlush()->getIterator() as $entity) { + $classMetadata = $this->em->getClassMetadata($entity::class); + $this->em->getUnitOfWork()->recomputeSingleEntityChangeSet($classMetadata, $entity); $this->em->flush($entity); } $this->em->commit();