Skip to content

Commit

Permalink
Merge pull request #1567 from ConductionNL/fix/XRZ-1/max-depth
Browse files Browse the repository at this point in the history
Do not check max depth if value is of type json
  • Loading branch information
rjzondervan authored Oct 12, 2023
2 parents 66a294d + 367c102 commit 62b4d98
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions api/src/Entity/ObjectEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,21 @@ public function toArray(array $configuration = []): array
// If we don't set the full object then we want to set self
else {
// $array[$attribute->getName()] = $object->getSelf() ?? ('/api' . ($object->getEntity()->getRoute() ?? $object->getEntity()->getName()) . '/' . $object->getId());
$array[$attribute->getName()] = $object->getSelf();
switch ($attribute->getFormat()) {
case 'uuid':
$array[$attribute->getName()] = $object->getId()->toString();
break;
case 'url':
$array[$attribute->getName()] = $object->getUri();
break;
case 'json':
$array[$attribute->getName()] = $objectToArray;
break;
case 'iri':
default:
$array[$attribute->getName()] = $object->getSelf();
break;
}
}
}
} elseif (count($valueObject->getObjects()) === 0) {
Expand Down Expand Up @@ -1261,8 +1275,22 @@ public function toArray(array $configuration = []): array
}
// If we don't set the full object then we want to set self
else {
// $array[$attribute->getName()][] = $object->getSelf() ?? ('/api' . ($object->getEntity()->getRoute() ?? $object->getEntity()->getName()) . '/' . $object->getId());
$array[$attribute->getName()][] = $object->getSelf();
switch ($attribute->getFormat()) {
case 'uuid':
$array[$attribute->getName()][] = $object->getId()->toString();
break;
case 'url':
case 'uri':
$array[$attribute->getName()][] = $object->getUri();
break;
case 'json':
$array[$attribute->getName()][] = $objectToArray;
break;
case 'iri':
default:
$array[$attribute->getName()][] = $object->getSelf();
break;
}
}
}
}
Expand Down

0 comments on commit 62b4d98

Please sign in to comment.