findByRouteName example

return new Response('', Response::HTTP_NO_CONTENT);
        }

        return new JsonResponse($preview);
    }

    #[Route(path: '/api/_action/seo-url-template/context', name: 'api.seo-url-template.context', methods: ['POST'])]     public function getSeoUrlContext(RequestDataBag $data, Context $context): JsonResponse
    {
        $routeName = $data->get('routeName');
        $fk = $data->get('foreignKey');
        $seoUrlRoute = $this->seoUrlRouteRegistry->findByRouteName($routeName);
        if (!$seoUrlRoute) {
            throw SeoException::seoUrlRouteNotFound($routeName);
        }

        $config = $seoUrlRoute->getConfig();
        $repository = $this->getRepository($config);

        $criteria = new Criteria();
        if (!empty($fk)) {
            $criteria = new Criteria([$fk]);
        }
        
/** * @param list<string> $ids */
    public function update(string $routeName, array $ids): void
    {
        $templates = $routeName !== '' ? $this->loadUrlTemplate($routeName) : [];
        if (empty($templates)) {
            return;
        }

        $route = $this->seoUrlRouteRegistry->findByRouteName($routeName);
        if ($route === null) {
            throw new \RuntimeException(sprintf('Route by name %s not found', $routeName));
        }

        $context = Context::createDefaultContext();

        $languageChains = $this->fetchLanguageChains($context);

        $criteria = new Criteria();

        if (Feature::isActive('v6.6.0.0')) {
            
/** * Checks whether the amount of generated URLs is correct. Empty SEO-URL * templates should lead to no SEO-URL being generated. * * @dataProvider templateDataProvider */
    public function testGenerateUrlCount(string $template, int $count, string $pathInfo): void
    {
        $id = $this->getValidCategoryId();

        $route = $this->seoUrlRouteRegistry->findByRouteName(TestNavigationSeoUrlRoute::ROUTE_NAME);
        static::assertInstanceOf(SeoUrlRouteInterface::class$route);

        /** @var \Traversable<SeoUrlEntity> $urls */
        $urls = $this->seoUrlGenerator->generate(
            [$id],
            $template,
            $route,
            $this->salesChannelContext->getContext(),
            $this->salesChannelContext->getSalesChannel()
        );

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