$entity =
$repository ->
search($criteria,
$context) ->
first();
if (!
$entity) { return new JsonResponse(null, Response::HTTP_NOT_FOUND
);
} $mapping =
$seoUrlRoute->
getMapping($entity, null
);
return new JsonResponse($mapping->
getSeoPathInfoContext());
} #[Route(path: '/api/_action/seo-url/canonical', name: 'api.seo-url.canonical', methods: ['PATCH'])]
public function updateCanonicalUrl(RequestDataBag
$seoUrl, Context
$context): Response
{ if (!
$seoUrl->
has('routeName'
)) { throw SeoException::
routeNameParameterIsMissing();
} $seoUrlRoute =
$this->seoUrlRouteRegistry->
findByRouteName($seoUrl->
get('routeName'
) ?? ''
);
if (!
$seoUrlRoute) {