mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
replace old method of getting translator with injection of translatorInterface
This commit is contained in:
@@ -113,7 +113,7 @@ class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Contr
|
||||
$em->remove($accompanyingCourse);
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', $this->get('translator')
|
||||
$this->addFlash('success', $this->translator
|
||||
->trans('The accompanying course has been successfully removed.'));
|
||||
|
||||
if (null !== $person_id) {
|
||||
|
@@ -18,6 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* Class PersonAddressController
|
||||
@@ -25,17 +26,11 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
*/
|
||||
class PersonAddressController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @var ValidatorInterface
|
||||
*/
|
||||
protected $validator;
|
||||
|
||||
/**
|
||||
* PersonAddressController constructor.
|
||||
*/
|
||||
public function __construct(ValidatorInterface $validator)
|
||||
public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,14 +72,14 @@ class PersonAddressController extends AbstractController
|
||||
|
||||
$this->addFlash(
|
||||
'success',
|
||||
$this->get('translator')->trans('The new address was created successfully')
|
||||
$this->translator->trans('The new address was created successfully')
|
||||
);
|
||||
|
||||
return $this->redirectToRoute('chill_person_address_list', [
|
||||
'person_id' => $person->getId(),
|
||||
]);
|
||||
} else {
|
||||
$this->addFlash('error', $this->get('translator')
|
||||
$this->addFlash('error', $this->translator
|
||||
->trans('Error! Address not created!'));
|
||||
}
|
||||
}
|
||||
@@ -213,7 +208,7 @@ class PersonAddressController extends AbstractController
|
||||
$this->getDoctrine()->getManager()
|
||||
->flush();
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans(
|
||||
$this->addFlash('success', $this->translator->trans(
|
||||
'The address has been successfully updated'
|
||||
));
|
||||
|
||||
@@ -221,7 +216,7 @@ class PersonAddressController extends AbstractController
|
||||
'person_id' => $person->getId(),
|
||||
]);
|
||||
} else {
|
||||
$this->addFlash('error', $this->get('translator')
|
||||
$this->addFlash('error', $this->translator
|
||||
->trans('Error when updating the period'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user