diff --git a/api/src/Entity/ObjectEntity.php b/api/src/Entity/ObjectEntity.php index f659dde1a..dc83993f0 100644 --- a/api/src/Entity/ObjectEntity.php +++ b/api/src/Entity/ObjectEntity.php @@ -1184,6 +1184,12 @@ public function toArray(array $configuration = []): array $config['maxDepth'] = $attribute->getObject()->getMaxDepth() + $config['level']; } $config['level'] = $config['level'] + 1; + + //TODO: This is a very hacky solution that has to be changed back ASAP + if ($attribute->getObject() === $this->getEntity()) { + $config['maxDepth'] = $config['level']; + } + $objectToArray = $object->toArray($config); // Check if we want an embedded array