buildValidation example

    public function updateCanonicalUrl(RequestDataBag $seoUrl, Context $context): Response
    {
        if (!$seoUrl->has('routeName')) {
            throw SeoException::routeNameParameterIsMissing();
        }

        $seoUrlRoute = $this->seoUrlRouteRegistry->findByRouteName($seoUrl->get('routeName') ?? '');
        if (!$seoUrlRoute) {
            throw SeoException::seoUrlRouteNotFound($seoUrl->get('routeName'));
        }

        $validation = $this->seoUrlValidator->buildValidation($context$seoUrlRoute->getConfig());

        $seoUrlData = $seoUrl->all();
        $this->validator->validate($seoUrlData$validation);
        $seoUrlData['isModified'] ??= true;

        $salesChannelId = $seoUrlData['salesChannelId'] ?? null;

        if ($salesChannelId === null) {
            throw SeoException::salesChannelIdParameterIsMissing();
        }

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