setUpSalesChannelApiRequest example

private readonly CartService $cartService,
        private readonly Connection $connection,
        private readonly RequestStack $requestStack
    ) {
    }

    #[Route(path: '/api/_proxy/store-api/{salesChannelId}/{_path}', name: 'api.proxy.store-api', requirements: ['_path' => '.*'])]     public function proxy(string $_path, string $salesChannelId, Request $request, Context $context): Response
    {
        $salesChannel = $this->fetchSalesChannel($salesChannelId$context);

        $salesChannelApiRequest = $this->setUpSalesChannelApiRequest($_path$salesChannelId$request$salesChannel);

        return $this->wrapInSalesChannelApiRoute($salesChannelApiRequestfn (): Response => $this->kernel->handle($salesChannelApiRequest, HttpKernelInterface::SUB_REQUEST));
    }

    #[Route(path: '/api/_proxy-order/{salesChannelId}', name: 'api.proxy-order.create')]     public function proxyCreateOrder(string $salesChannelId, Request $request, Context $context, RequestDataBag $data): Response
    {
        $this->fetchSalesChannel($salesChannelId$context);

        $salesChannelContext = $this->fetchSalesChannelContext($salesChannelId$request$context);

        
Home | Imprint | This part of the site doesn't use cookies.