$criteria->
addFilter(new NotFilter( NotFilter::CONNECTION_AND,
[new EqualsFilter('id',
$documentId)] ));
} $criteria->
setLimit(1
);
$result =
$this->documentRepository->
searchIds($criteria,
$context);
if ($result->
getTotal() !== 0
) { throw new DocumentNumberAlreadyExistsException($documentNumber);
} } private function ensureDocumentMediaFileGenerated(DocumentEntity
$document, Context
$context): DocumentEntity
{ $documentMediaId =
$document->
getDocumentMediaFileId();
if ($documentMediaId !== null ||
$document->
isStatic()) { return $document;
}