diff --git a/EMS/submission-bundle/src/Entity/FormSubmission.php b/EMS/submission-bundle/src/Entity/FormSubmission.php index 46a5dad61..97aa3c585 100644 --- a/EMS/submission-bundle/src/Entity/FormSubmission.php +++ b/EMS/submission-bundle/src/Entity/FormSubmission.php @@ -144,7 +144,8 @@ public function toArray(): array } if ($this->files->count() > 0) { - $data['files'] = $this->files->toArray(); + $files = $this->files->toArray(); + $data['files'] = \array_map(static fn (FormSubmissionFile $f) => $f->toArray(), $files); } else { unset($data['files']); } diff --git a/EMS/submission-bundle/src/Entity/FormSubmissionFile.php b/EMS/submission-bundle/src/Entity/FormSubmissionFile.php index 13a599a3b..4f189b594 100644 --- a/EMS/submission-bundle/src/Entity/FormSubmissionFile.php +++ b/EMS/submission-bundle/src/Entity/FormSubmissionFile.php @@ -93,6 +93,14 @@ public function __construct(/** * @return array */ public function jsonSerialize(): array + { + return $this->toArray(); + } + + /** + * @return array + */ + public function toArray(): array { return [ 'id' => $this->id->toString(),