public function load(array
$documentIds, Context
$context): array
{ $attachments =
[];
$criteria =
new Criteria($documentIds);
$criteria->
addAssociation('documentMediaFile'
);
$criteria->
addAssociation('documentType'
);
$criteriaEvent =
new AttachmentLoaderCriteriaEvent($criteria);
$this->eventDispatcher->
dispatch($criteriaEvent);
$entities =
$this->documentRepository->
search($criteria,
$context);
/** @var DocumentEntity $document */
foreach ($entities as $document) { $document =
$this->documentGenerator->
readDocument($document->
getId(),
$context);
if ($document === null
) { continue;
}