From b6620dd95650154417e7291fe5e91b2e56a1beb2 Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Thu, 23 Nov 2023 09:51:40 +0100 Subject: [PATCH] Fix to prevent duplicates when loading in testdata --- api/src/Entity/Value.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/Entity/Value.php b/api/src/Entity/Value.php index 49d2d03ee..91154a87d 100644 --- a/api/src/Entity/Value.php +++ b/api/src/Entity/Value.php @@ -661,10 +661,10 @@ public function setValue($value, bool $unsafe = false, ?DateTimeInterface $dateM if (is_array($value)) { $object = null; - // Make sure to not create new objects if we don't have to... - if (isset($value['id'])) { + // Make sure to not create new objects if we don't have to (_id in testdata)... + if (isset($value['_id'])) { $objects = $this->objects->filter(function ($item) use ($value) { - return $item->getId() !== null && $item->getId()->toString() === $value['id']; + return $item->getId() !== null && $item->getId()->toString() === $value['_id']; }); if (count($objects) > 0) {