/** * {@inheritdoc} * * @throws InvalidConfigurationException if the parameter name is missing * @throws AccessDeniedHttpException if the current user is not authenticated */ public function apply(Request $request, ParamConverter $configuration) { $slug = $request->attributes->get('slug'); $options = $configuration->getOptions(); if (isset($options['check_deleted']) && !$options['check_deleted']) { $this->entityManager->getFilters()->disable('softdeleteable'); } $badge = $this->badgeRepository->findBySlug($slug); if (null === $badge) { throw new NotFoundHttpException(); } $parameterName = $configuration->getName(); $request->attributes->set($parameterName, $badge); return true; }