fix: [analyst-data:attachData] Make sure to also load child notes and opinions

Changed the old behavior: Before we were loading 3 children. Now, we only load 1 by default.
pull/9665/head
Sami Mokaddem 2024-04-03 16:42:18 +02:00
parent 94dd4fa093
commit 3d8fe9d90e
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 5 additions and 0 deletions

View File

@ -377,6 +377,8 @@ class AnalystData extends AppModel
return $analystData;
}
$this->fetchedUUIDFromRecursion[$analystData['uuid']] = true;
$this->Note = ClassRegistry::init('Note');
$this->Opinion = ClassRegistry::init('Opinion');
$paramsNote = [
'recursive' => -1,

View File

@ -31,6 +31,9 @@ class AnalystDataParentBehavior extends ModelBehavior
$temp = $this->{$type}->fetchForUuid($object['uuid'], $this->__currentUser);
if (!empty($temp)) {
foreach ($temp as $k => $temp_element) {
if (in_array($type, ['Note', 'Opinion', 'Relationship'])) {
$temp_element[$type] = $this->{$type}->fetchChildNotesAndOpinions($this->__currentUser, $temp_element[$type], 1);
}
$data[$type][] = $temp_element[$type];
}
}