loadEsdOfCustomer example

$downloadService = $this->container->get('shopware_static_content.service.download_service');
        $filesystem = $this->container->get('shopware.filesystem.private');
        $esdID = (int) $this->request->getParam('esdID', 0);

        if ($esdID === 0) {
            $this->forward('downloads');

            return;
        }

        try {
            $download = $esdService->loadEsdOfCustomer($this->container->get('session')->offsetGet('sUserId')$esdID);
        } catch (EsdNotFoundException $exception) {
            $this->forwardDownloadError(1);

            return;
        }

        if (empty($download->getFile())) {
            $this->forwardDownloadError(1);

            return;
        }

        
EsdGatewayInterface $esdGateway
    ) {
        $this->config = $config;
        $this->esdGateway = $esdGateway;
    }

    /** * {@inheritdoc} */
    public function loadEsdOfCustomer(int $customerId, int $esdId): Esd
    {
        return $this->esdGateway->loadEsdOfCustomer($customerId$esdId);
    }

    /** * {@inheritdoc} */
    public function getLocation(Esd $esd): string
    {
        return $this->config->offsetGet('esdKey') . '/' . $esd->getFile();
    }
}
Home | Imprint | This part of the site doesn't use cookies.