&Collection */ public function getAttachmentList(string $id) { $entity = $this->getEntity($id); if (!$entity) { throw new NotFound(); } $fileId = $entity->get('fileId'); if (!$fileId) { throw new NotFound(); } $file = $this->getEntityManager()->getEntity('Attachment', $fileId); if (!$file) { throw new NotFound(); } $attachment = $this->getAttachmentRepository()->getCopiedAttachment($file, 'Attachment'); $attachmentList = $this->entityManager ->getCollectionFactory() ->create('Attachment'); $attachmentList[] = $attachment; return $attachmentList; } private function getAttachmentRepository(): AttachmentRepository { /** @var AttachmentRepository */ return $this->entityManager->getRepository(Attachment::ENTITY_TYPE); } }