private readonly FilesystemOperator
$filesystemPublic,
private readonly FilesystemOperator
$filesystemPrivate,
private readonly UrlGeneratorInterface
$urlGenerator,
private readonly EntityRepository
$mediaRepository,
private readonly StreamFactoryInterface
$streamFactory ) { $this->fileNameValidator =
new FileNameValidator();
} public function loadMediaFile(string
$mediaId, Context
$context): string
{ $media =
$this->
findMediaById($mediaId,
$context);
return $this->
getFileSystem($media)->
read($this->
getFilePath($media)) ?: '';
} public function loadMediaFileStream(string
$mediaId, Context
$context): StreamInterface
{ $media =
$this->
findMediaById($mediaId,
$context);
$resource =
$this->
getFileSystem($media)->
readStream($this->
getFilePath($media));
return $this->streamFactory->
createStreamFromResource($resource);
}