mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-03 18:58:24 +00:00 
			
		
		
		
	DX: Remove deprecation on $this->get inside controller
				
					
				
			This commit is contained in:
		@@ -45,6 +45,7 @@ use Symfony\Component\HttpFoundation\Response;
 | 
			
		||||
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
 | 
			
		||||
use Symfony\Component\Routing\Annotation\Route;
 | 
			
		||||
use Symfony\Component\Serializer\SerializerInterface;
 | 
			
		||||
use Symfony\Contracts\Translation\TranslatorInterface;
 | 
			
		||||
 | 
			
		||||
class CalendarController extends AbstractController
 | 
			
		||||
{
 | 
			
		||||
@@ -68,6 +69,8 @@ class CalendarController extends AbstractController
 | 
			
		||||
 | 
			
		||||
    private TranslatableStringHelperInterface $translatableStringHelper;
 | 
			
		||||
 | 
			
		||||
    private TranslatorInterface $translator;
 | 
			
		||||
 | 
			
		||||
    private UserRepositoryInterface $userRepository;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
@@ -81,7 +84,8 @@ class CalendarController extends AbstractController
 | 
			
		||||
        TranslatableStringHelperInterface $translatableStringHelper,
 | 
			
		||||
        PersonRepository $personRepository,
 | 
			
		||||
        AccompanyingPeriodRepository $accompanyingPeriodRepository,
 | 
			
		||||
        UserRepositoryInterface $userRepository
 | 
			
		||||
        UserRepositoryInterface $userRepository,
 | 
			
		||||
        TranslatorInterface $translator
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->calendarACLAwareRepository = $calendarACLAwareRepository;
 | 
			
		||||
        $this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository;
 | 
			
		||||
@@ -94,6 +98,7 @@ class CalendarController extends AbstractController
 | 
			
		||||
        $this->personRepository = $personRepository;
 | 
			
		||||
        $this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
 | 
			
		||||
        $this->userRepository = $userRepository;
 | 
			
		||||
        $this->translator = $translator;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -131,7 +136,7 @@ class CalendarController extends AbstractController
 | 
			
		||||
                $em->remove($entity);
 | 
			
		||||
                $em->flush();
 | 
			
		||||
 | 
			
		||||
                $this->addFlash('success', $this->get('translator')
 | 
			
		||||
                $this->addFlash('success', $this->translator
 | 
			
		||||
                    ->trans('The calendar item has been successfully removed.'));
 | 
			
		||||
 | 
			
		||||
                return new RedirectResponse($redirectRoute);
 | 
			
		||||
@@ -190,7 +195,7 @@ class CalendarController extends AbstractController
 | 
			
		||||
        if ($form->isSubmitted() && $form->isValid()) {
 | 
			
		||||
            $em->flush();
 | 
			
		||||
 | 
			
		||||
            $this->addFlash('success', $this->get('translator')->trans('Success : calendar item updated!'));
 | 
			
		||||
            $this->addFlash('success', $this->translator->trans('Success : calendar item updated!'));
 | 
			
		||||
 | 
			
		||||
            if ($form->get('save_and_upload_doc')->isClicked()) {
 | 
			
		||||
                return $this->redirectToRoute('chill_calendar_calendardoc_new', ['id' => $entity->getId()]);
 | 
			
		||||
@@ -210,7 +215,7 @@ class CalendarController extends AbstractController
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($form->isSubmitted() && !$form->isValid()) {
 | 
			
		||||
            $this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
 | 
			
		||||
            $this->addFlash('error', $this->translator->trans('This form contains errors'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $entity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
 | 
			
		||||
@@ -369,7 +374,7 @@ class CalendarController extends AbstractController
 | 
			
		||||
            $em->persist($entity);
 | 
			
		||||
            $em->flush();
 | 
			
		||||
 | 
			
		||||
            $this->addFlash('success', $this->get('translator')->trans('Success : calendar item created!'));
 | 
			
		||||
            $this->addFlash('success', $this->translator->trans('Success : calendar item created!'));
 | 
			
		||||
 | 
			
		||||
            if ($form->get('save_and_upload_doc')->isClicked()) {
 | 
			
		||||
                return $this->redirectToRoute('chill_calendar_calendardoc_new', ['id' => $entity->getId()]);
 | 
			
		||||
@@ -393,7 +398,7 @@ class CalendarController extends AbstractController
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($form->isSubmitted() && !$form->isValid()) {
 | 
			
		||||
            $this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
 | 
			
		||||
            $this->addFlash('error', $this->translator->trans('This form contains errors'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (null === $view) {
 | 
			
		||||
 
 | 
			
		||||
@@ -356,7 +356,9 @@ class SocialIssue
 | 
			
		||||
    {
 | 
			
		||||
        $this->parent = $parent;
 | 
			
		||||
 | 
			
		||||
        $parent->addChild($this);
 | 
			
		||||
        if (null !== $parent) {
 | 
			
		||||
            $parent->addChild($this);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user