#[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();
} $cachedResponse =
$this->
readFromCache($cacheKey,
$context,
$request);
if ($cachedResponse) { return $cachedResponse;
}