Skip to content

Commit

Permalink
Merge pull request #135 from ConductionNL/fix/isset-items-type
Browse files Browse the repository at this point in the history
check isset items type
  • Loading branch information
bbrands02 authored Jan 16, 2025
2 parents 5ffd38d + 5976cd8 commit 9902344
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Service/ObjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ private function handleArrayProperty(
return $items;
}

if ($property['items']['type'] !== 'object'
if (isset($property['items']['type']) === true && $property['items']['type'] !== 'object'
&& $property['items']['type'] !== 'file'
) {
return $items;
Expand Down Expand Up @@ -1799,6 +1799,10 @@ public function setDefaults(ObjectEntity $objectEntity): ObjectEntity
$data = $objectEntity->jsonSerialize();
$schema = $this->schemaMapper->find($objectEntity->getSchema());

if ($schema->getProperties() === null) {
return $objectEntity;
}

foreach ($schema->getProperties() as $name=>$property) {
if (isset($data[$name]) === false && isset($property['default']) === true) {
$data[$name] = $this->twig->createTemplate($property['default'], "{$schema->getTitle()}.$name")->render($objectEntity->getObjectArray());
Expand Down

0 comments on commit 9902344

Please sign in to comment.