StoreApiHook example

private readonly TagAwareAdapterInterface $cache,
        private readonly LoggerInterface $logger
    ) {
    }

    #[Route(path: '/store-api/script/{hook}', name: 'store-api.script_endpoint', methods: ['GET', 'POST'], requirements: ['hook' => '.+'])]     public function execute(string $hook, Request $request, SalesChannelContext $context): Response
    {
        // blog/update => blog-update         $hookName = \str_replace('/', '-', $hook);

        $hook = new StoreApiHook($hookName$request->request->all()$request->query->all()$context);

        $cacheKey = null;
        if ($request->isMethodCacheable()) {
            /** @var StoreApiCacheKeyHook $cacheKeyHook */
            $cacheKeyHook = $hook->getFunction(StoreApiCacheKeyHook::FUNCTION_NAME);

            $this->executor->execute($cacheKeyHook);

            $cacheKey = $cacheKeyHook->getCacheKey();
        }

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