Skip to content

Commit

Permalink
Merge branch 'feature/IBOC-99/objects-controller' of https://github.c…
Browse files Browse the repository at this point in the history
…om/ConductionNL/opencatalogi into feature/IBOC-99/objects-controller
rubenvdlinde committed Jan 24, 2025
2 parents c130864 + 6b14d21 commit 1740c5f
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Service/DirectoryService.php
Original file line number Diff line number Diff line change
@@ -295,7 +295,7 @@ public function updateListing(array $newListing, array $oldListing): array{
}

// Do not update version, because we copy the version from the source
$newListing = $this->objectService->saveObject('listing', $oldListing, false);
$newListing = $this->objectService->saveObject('listing', $oldListing, updateVersion: false);

return $newListing instanceof Listing === true ? $newListing->jsonSerialize() : $newListing;
}
6 changes: 3 additions & 3 deletions lib/Service/ObjectService.php
Original file line number Diff line number Diff line change
@@ -310,7 +310,7 @@ public function getAllObjects(string $objectType, ?int $limit = null, ?int $offs
* @return mixed The created or updated object.
* @throws ContainerExceptionInterface|DoesNotExistException|MultipleObjectsReturnedException|NotFoundExceptionInterface
*/
public function saveObject(string $objectType, array $object, bool $updateVersion = true): mixed
public function saveObject(string $objectType, array $object, array $extend = [], bool $updateVersion = true): mixed
{
if ($objectType === 'publication') {
$object = $this->validationService->validatePublication($object);
@@ -321,10 +321,10 @@ public function saveObject(string $objectType, array $object, bool $updateVersio

// If the object has an id, update it; otherwise, create a new object
if (isset($object['id']) === true) {
return $mapper->updateFromArray($object['id'], $object, $updateVersion, patch: true);
return $mapper->updateFromArray($object['id'], $object, $updateVersion, patch: true, extend: $extend);
}
else {
return $mapper->createFromArray($object);
return $mapper->createFromArray(object: $object, extend: $extend);
}
}

0 comments on commit 1740c5f

Please sign in to comment.