Skip to content

Commit

Permalink
Handling nicely if childless person
Browse files Browse the repository at this point in the history
  • Loading branch information
stankut committed Mar 28, 2023
1 parent 84c97e0 commit bbe14ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Plugin/os2web/DataLookup/ServiceplatformenCPRExtended.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ public function lookup($cpr, $allowCprTestModeReplace = TRUE) {
}

$relationship = $result['relationer'];
if ($relationship->barn && is_array($relationship->barn)) {
if (isset($relationship->barn) && is_array($relationship->barn)) {
$children = [];
foreach ($relationship->barn as $child) {
$childCprResult = $this->lookup($child->personnummer, FALSE);

$children[] = [
'cpr' => $childCprResult->getCpr(),
'name' => $childCprResult->getName()
'name' => $childCprResult->getName(),
];
}
$cprResult->setChildren($children);
Expand Down

0 comments on commit bbe14ae

Please sign in to comment.