mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
replace old method of getting translator with injection of translatorInterface
This commit is contained in:
@@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* Class ParticipationController.
|
||||
@@ -32,7 +33,7 @@ class ParticipationController extends AbstractController
|
||||
/**
|
||||
* ParticipationController constructor.
|
||||
*/
|
||||
public function __construct(private readonly LoggerInterface $logger) {}
|
||||
public function __construct(private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) {}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create")
|
||||
@@ -177,7 +178,7 @@ class ParticipationController extends AbstractController
|
||||
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans(
|
||||
$this->addFlash('success', $this->translator->trans(
|
||||
'The participations were created'
|
||||
));
|
||||
|
||||
@@ -211,7 +212,7 @@ class ParticipationController extends AbstractController
|
||||
$em->persist($participation);
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans(
|
||||
$this->addFlash('success', $this->translator->trans(
|
||||
'The participation was created'
|
||||
));
|
||||
|
||||
@@ -260,7 +261,7 @@ class ParticipationController extends AbstractController
|
||||
|
||||
$this->addFlash(
|
||||
'success',
|
||||
$this->get('translator')
|
||||
$this->translator
|
||||
->trans('The participation has been sucessfully removed')
|
||||
);
|
||||
|
||||
@@ -340,7 +341,7 @@ class ParticipationController extends AbstractController
|
||||
switch ($event->getParticipations()->count()) {
|
||||
case 0:
|
||||
// if there aren't any participation, redirect to the 'show' view with an add flash
|
||||
$this->addFlash('warning', $this->get('translator')
|
||||
$this->addFlash('warning', $this->translator
|
||||
->trans('There are no participation to edit for this event'));
|
||||
|
||||
return $this->redirectToRoute(
|
||||
@@ -434,7 +435,7 @@ class ParticipationController extends AbstractController
|
||||
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans(
|
||||
$this->addFlash('success', $this->translator->trans(
|
||||
'The participation was updated'
|
||||
));
|
||||
|
||||
@@ -480,7 +481,7 @@ class ParticipationController extends AbstractController
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans('The participations '
|
||||
$this->addFlash('success', $this->translator->trans('The participations '
|
||||
.'have been successfully updated.'));
|
||||
|
||||
return $this->redirectToRoute(
|
||||
@@ -652,7 +653,7 @@ class ParticipationController extends AbstractController
|
||||
|
||||
if ([] === $newParticipations) {
|
||||
// if we do not have nay participants, redirect to event view
|
||||
$this->addFlash('error', $this->get('translator')->trans(
|
||||
$this->addFlash('error', $this->translator->trans(
|
||||
'None of the requested people may participate '
|
||||
.'the event: they are maybe already participating.'
|
||||
));
|
||||
|
Reference in New Issue
Block a user