if ($tempFile === null
) { $tempFile =
tempnam(sys_get_temp_dir(), ''
);
} $contentType =
$request->headers->
get('content_type', ''
);
if (str_starts_with($contentType, 'application/json'
)) { return $this->fileFetcher->
fetchFileFromURL($request,
$tempFile ?: ''
);
} return $this->fileFetcher->
fetchRequestData($request,
$tempFile ?: ''
);
} /**
* @return array{content: string, fileName: non-falsy-string, mimeType: string|null}
*/
public function getAttachment(MediaEntity
$media, Context
$context): array
{ $fileBlob = '';
$mediaService =
$this;
$context->
scope(Context::SYSTEM_SCOPE,
static function DContext
$context) use ($mediaService,
$media, &
$fileBlob): void
{ $fileBlob =
$mediaService->
loadFile($media->
getId(),
$context);
});