Skip to content

Commit

Permalink
Merge pull request #1583 from ConductionNL/feature/test-data-duplicat…
Browse files Browse the repository at this point in the history
…es-fix

Fix to prevent duplicates when loading in testdata
  • Loading branch information
WilcoLouwerse authored Nov 23, 2023
2 parents a67cb9f + b6620dd commit 65e3a66
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/src/Entity/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 65e3a66

Please sign in to comment.