Skip to content

Commit

Permalink
Fix access to array item
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Feb 4, 2025
1 parent ea2e397 commit 7bbcd25
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
if(!empty($value) && str_ends_with($attribute->attribute, 'person_id')) {
// We need to load the associated model data
$associatedModel = $this->Petition->getRecordForId('person_id', $attr->value, ['PrimaryName']);
$value = $associatedModel[0]->primary_name->given . ' '
. $associatedModel[0]->primary_name->family . ' '
. '(ID: ' . $associatedModel[0]->id . ')';
$value = $associatedModel['primary_name']['given'] . ' '
. $associatedModel['primary_name']['family'] . ' '
. '(ID: ' . $associatedModel['id'] . ')';
$value = $this->Html->link($value,
['controller' => 'people', 'action' => 'edit', $attr->value]);
} elseif(!empty($value) && str_ends_with($attribute->attribute, '_id')) {
Expand Down

0 comments on commit 7bbcd25

Please sign in to comment.