private readonly ProductExportFileHandlerInterface
$productExportFileHandler,
private readonly FilesystemOperator
$fileSystem,
private readonly EventDispatcherInterface
$eventDispatcher,
private readonly EntityRepository
$productExportRepository,
private readonly AbstractSalesChannelContextFactory
$contextFactory ) { } #[Route(path: '/store-api/product-export/{accessKey}/{fileName}', name: 'store-api.product.export', methods: ['GET'], defaults: ['auth_required' => false])]
public function index(Request
$request): Response
{ $criteria =
new Criteria();
$criteria ->
addFilter(new EqualsFilter('fileName',
$request->
get('fileName'
))) ->
addFilter(new EqualsFilter('accessKey',
$request->
get('accessKey'
))) ->
addFilter(new EqualsFilter('salesChannel.active', true
)) ->
addAssociation('salesChannelDomain'
);
/** @var ProductExportEntity|null $productExport */
$productExport =
$this->productExportRepository->
search($criteria, Context::
createDefaultContext())->
first();
if ($productExport === null
) { $exportNotFoundException =
new ExportNotFoundException(null,
$request->
get('fileName'
));