new: [API rearrange] added a simplifier for commonly used objects

- let's only return the subset of the data required to identify and retrieve the related data
cli-modification-summary
iglocska 2022-11-04 09:58:55 +01:00
parent 540fd63423
commit 003053f13d
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 18 additions and 0 deletions

View File

@ -99,4 +99,22 @@ class AppModel extends Entity
}
return $rearrangedAlignments;
}
public function rearrangeSimplify(array $typesToRearrange): void
{
if (in_array('organisation', $typesToRearrange) && isset($this->organisation)) {
$this->organisation = [
'id' => $this->organisation['id'],
'name' => $this->organisation['name'],
'uuid' => $this->organisation['uuid']
];
}
if (in_array('individual', $typesToRearrange) && isset($this->individual)) {
$this->individual = [
'id' => $this->individual['id'],
'email' => $this->individual['email'],
'uuid' => $this->individual['uuid']
];
}
}
}