Skip to content

Commit

Permalink
Update ObjectService.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanbaidan authored Nov 24, 2023
1 parent 0ee7793 commit 470cf1d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Service/ObjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,15 @@ public function getCompleteEntity($id, $anrContext = MonarcObject::CONTEXT_BDC,
// Retrieve parent recursively
if ($anrContext == MonarcObject::CONTEXT_ANR) {
//Check if the object is linked to the $anr
$found = false;
$anrObject = null;
foreach ($object->getAnrs() as $a) {
if ($a->getId() === $anr) {
$found = true;
$anrObject = $a;
break;
$found = $object->getAnr() !== null;
$anrObject = $object->getAnr();
if ($anrObject === null) {
foreach ($object->getAnrs() as $a) {
if ($a->getId() === $anr) {
$found = true;
$anrObject = $a;
break;
}
}
}

Expand Down

0 comments on commit 470cf1d

Please sign in to comment.