mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'replace_translator'
This commit is contained in:
commit
728fd642fa
5
.changes/unreleased/Fixed-20231026-152205.yaml
Normal file
5
.changes/unreleased/Fixed-20231026-152205.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: Replace old method of getting translator with injection of translatorInterface
|
||||||
|
time: 2023-10-26T15:22:05.134223653+02:00
|
||||||
|
custom:
|
||||||
|
Issue: "175"
|
@ -18,12 +18,15 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CustomFieldController.
|
* Class CustomFieldController.
|
||||||
*/
|
*/
|
||||||
class CustomFieldController extends AbstractController
|
class CustomFieldController extends AbstractController
|
||||||
{
|
{
|
||||||
|
public function __construct(private readonly TranslatorInterface $translator) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new CustomField entity.
|
* Creates a new CustomField entity.
|
||||||
*
|
*
|
||||||
@ -40,13 +43,13 @@ class CustomFieldController extends AbstractController
|
|||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')
|
$this->addFlash('success', $this->translator
|
||||||
->trans('The custom field has been created'));
|
->trans('The custom field has been created'));
|
||||||
|
|
||||||
return $this->redirectToRoute('customfieldsgroup_show', ['id' => $entity->getCustomFieldsGroup()->getId()]);
|
return $this->redirectToRoute('customfieldsgroup_show', ['id' => $entity->getCustomFieldsGroup()->getId()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addFlash('error', $this->get('translator')
|
$this->addFlash('error', $this->translator
|
||||||
->trans('The custom field form contains errors'));
|
->trans('The custom field form contains errors'));
|
||||||
|
|
||||||
return $this->render('@ChillCustomFields/CustomField/new.html.twig', [
|
return $this->render('@ChillCustomFields/CustomField/new.html.twig', [
|
||||||
@ -130,13 +133,13 @@ class CustomFieldController extends AbstractController
|
|||||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')
|
$this->addFlash('success', $this->translator
|
||||||
->trans('The custom field has been updated'));
|
->trans('The custom field has been updated'));
|
||||||
|
|
||||||
return $this->redirectToRoute('customfield_edit', ['id' => $id]);
|
return $this->redirectToRoute('customfield_edit', ['id' => $id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addFlash('error', $this->get('translator')
|
$this->addFlash('error', $this->translator
|
||||||
->trans('The custom field form contains errors'));
|
->trans('The custom field form contains errors'));
|
||||||
|
|
||||||
return $this->render('@ChillCustomFields/CustomField/edit.html.twig', [
|
return $this->render('@ChillCustomFields/CustomField/edit.html.twig', [
|
||||||
|
@ -118,7 +118,7 @@ class EventController extends AbstractController
|
|||||||
|
|
||||||
$this->addFlash(
|
$this->addFlash(
|
||||||
'success',
|
'success',
|
||||||
$this->get('translator')
|
$this->translator
|
||||||
->trans('The event has been sucessfully removed')
|
->trans('The event has been sucessfully removed')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ class EventController extends AbstractController
|
|||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')
|
$this->addFlash('success', $this->translator
|
||||||
->trans('The event was created'));
|
->trans('The event was created'));
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_event__event_show', ['event_id' => $entity->getId()]);
|
return $this->redirectToRoute('chill_event__event_show', ['event_id' => $entity->getId()]);
|
||||||
@ -364,7 +364,7 @@ class EventController extends AbstractController
|
|||||||
if ($editForm->isValid()) {
|
if ($editForm->isValid()) {
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')
|
$this->addFlash('success', $this->translator
|
||||||
->trans('The event was updated'));
|
->trans('The event was updated'));
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_event__event_edit', ['event_id' => $event_id]);
|
return $this->redirectToRoute('chill_event__event_edit', ['event_id' => $event_id]);
|
||||||
|
@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ParticipationController.
|
* Class ParticipationController.
|
||||||
@ -32,7 +33,7 @@ class ParticipationController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* ParticipationController constructor.
|
* 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")
|
* @\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();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')->trans(
|
$this->addFlash('success', $this->translator->trans(
|
||||||
'The participations were created'
|
'The participations were created'
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ class ParticipationController extends AbstractController
|
|||||||
$em->persist($participation);
|
$em->persist($participation);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')->trans(
|
$this->addFlash('success', $this->translator->trans(
|
||||||
'The participation was created'
|
'The participation was created'
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -260,7 +261,7 @@ class ParticipationController extends AbstractController
|
|||||||
|
|
||||||
$this->addFlash(
|
$this->addFlash(
|
||||||
'success',
|
'success',
|
||||||
$this->get('translator')
|
$this->translator
|
||||||
->trans('The participation has been sucessfully removed')
|
->trans('The participation has been sucessfully removed')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -340,7 +341,7 @@ class ParticipationController extends AbstractController
|
|||||||
switch ($event->getParticipations()->count()) {
|
switch ($event->getParticipations()->count()) {
|
||||||
case 0:
|
case 0:
|
||||||
// if there aren't any participation, redirect to the 'show' view with an add flash
|
// 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'));
|
->trans('There are no participation to edit for this event'));
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
@ -434,7 +435,7 @@ class ParticipationController extends AbstractController
|
|||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')->trans(
|
$this->addFlash('success', $this->translator->trans(
|
||||||
'The participation was updated'
|
'The participation was updated'
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -480,7 +481,7 @@ class ParticipationController extends AbstractController
|
|||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$this->getDoctrine()->getManager()->flush();
|
$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.'));
|
.'have been successfully updated.'));
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
@ -652,7 +653,7 @@ class ParticipationController extends AbstractController
|
|||||||
|
|
||||||
if ([] === $newParticipations) {
|
if ([] === $newParticipations) {
|
||||||
// if we do not have nay participants, redirect to event view
|
// 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 '
|
'None of the requested people may participate '
|
||||||
.'the event: they are maybe already participating.'
|
.'the event: they are maybe already participating.'
|
||||||
));
|
));
|
||||||
|
@ -32,12 +32,13 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class UserController extends CRUDController
|
class UserController extends CRUDController
|
||||||
{
|
{
|
||||||
final public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter';
|
final public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter';
|
||||||
|
|
||||||
public function __construct(private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag) {}
|
public function __construct(private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag, private readonly TranslatorInterface $translator) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter",
|
* @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter",
|
||||||
@ -65,7 +66,7 @@ class UserController extends CRUDController
|
|||||||
if (0 === $this->validator->validate($user)->count()) {
|
if (0 === $this->validator->validate($user)->count()) {
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')->trans('The '
|
$this->addFlash('success', $this->translator->trans('The '
|
||||||
.'permissions have been successfully added to the user'));
|
.'permissions have been successfully added to the user'));
|
||||||
|
|
||||||
$returnPathParams = $request->query->has('returnPath') ?
|
$returnPathParams = $request->query->has('returnPath') ?
|
||||||
@ -115,14 +116,14 @@ class UserController extends CRUDController
|
|||||||
try {
|
try {
|
||||||
$user->removeGroupCenter($groupCenter);
|
$user->removeGroupCenter($groupCenter);
|
||||||
} catch (\RuntimeException $ex) {
|
} catch (\RuntimeException $ex) {
|
||||||
$this->addFlash('error', $this->get('translator')->trans($ex->getMessage()));
|
$this->addFlash('error', $this->translator->trans($ex->getMessage()));
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
|
return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')
|
$this->addFlash('success', $this->translator
|
||||||
->trans('The permissions where removed.'));
|
->trans('The permissions where removed.'));
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
|
return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
|
||||||
@ -207,7 +208,7 @@ class UserController extends CRUDController
|
|||||||
$user->setCurrentLocation($currentLocation);
|
$user->setCurrentLocation($currentLocation);
|
||||||
|
|
||||||
$this->getDoctrine()->getManager()->flush();
|
$this->getDoctrine()->getManager()->flush();
|
||||||
$this->addFlash('success', $this->get('translator')->trans('Current location successfully updated'));
|
$this->addFlash('success', $this->translator->trans('Current location successfully updated'));
|
||||||
|
|
||||||
return $this->redirect(
|
return $this->redirect(
|
||||||
$request->query->has('returnPath') ? $request->query->get('returnPath') :
|
$request->query->has('returnPath') ? $request->query->get('returnPath') :
|
||||||
@ -243,7 +244,7 @@ class UserController extends CRUDController
|
|||||||
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
|
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
|
||||||
|
|
||||||
$this->getDoctrine()->getManager()->flush();
|
$this->getDoctrine()->getManager()->flush();
|
||||||
$this->addFlash('success', $this->get('translator')->trans('Password successfully updated!'));
|
$this->addFlash('success', $this->translator->trans('Password successfully updated!'));
|
||||||
|
|
||||||
return $this->redirect(
|
return $this->redirect(
|
||||||
$request->query->has('returnPath') ? $request->query->get('returnPath') :
|
$request->query->has('returnPath') ? $request->query->get('returnPath') :
|
||||||
|
@ -113,7 +113,7 @@ class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Contr
|
|||||||
$em->remove($accompanyingCourse);
|
$em->remove($accompanyingCourse);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')
|
$this->addFlash('success', $this->translator
|
||||||
->trans('The accompanying course has been successfully removed.'));
|
->trans('The accompanying course has been successfully removed.'));
|
||||||
|
|
||||||
if (null !== $person_id) {
|
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\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PersonAddressController
|
* Class PersonAddressController
|
||||||
@ -25,18 +26,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||||||
*/
|
*/
|
||||||
class PersonAddressController extends AbstractController
|
class PersonAddressController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var ValidatorInterface
|
|
||||||
*/
|
|
||||||
protected $validator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PersonAddressController constructor.
|
* PersonAddressController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(ValidatorInterface $validator)
|
public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator) {}
|
||||||
{
|
|
||||||
$this->validator = $validator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"})
|
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"})
|
||||||
@ -77,14 +70,14 @@ class PersonAddressController extends AbstractController
|
|||||||
|
|
||||||
$this->addFlash(
|
$this->addFlash(
|
||||||
'success',
|
'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', [
|
return $this->redirectToRoute('chill_person_address_list', [
|
||||||
'person_id' => $person->getId(),
|
'person_id' => $person->getId(),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$this->addFlash('error', $this->get('translator')
|
$this->addFlash('error', $this->translator
|
||||||
->trans('Error! Address not created!'));
|
->trans('Error! Address not created!'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,7 +206,7 @@ class PersonAddressController extends AbstractController
|
|||||||
$this->getDoctrine()->getManager()
|
$this->getDoctrine()->getManager()
|
||||||
->flush();
|
->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')->trans(
|
$this->addFlash('success', $this->translator->trans(
|
||||||
'The address has been successfully updated'
|
'The address has been successfully updated'
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -221,7 +214,7 @@ class PersonAddressController extends AbstractController
|
|||||||
'person_id' => $person->getId(),
|
'person_id' => $person->getId(),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$this->addFlash('error', $this->get('translator')
|
$this->addFlash('error', $this->translator
|
||||||
->trans('Error when updating the period'));
|
->trans('Error when updating the period'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,39 +22,22 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReportController.
|
* Class ReportController.
|
||||||
*/
|
*/
|
||||||
class ReportController extends AbstractController
|
class ReportController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var AuthorizationHelper
|
|
||||||
*/
|
|
||||||
protected $authorizationHelper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var EventDispatcherInterface
|
|
||||||
*/
|
|
||||||
protected $eventDispatcher;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var PaginatorFactory
|
|
||||||
*/
|
|
||||||
protected $paginator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReportController constructor.
|
* ReportController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EventDispatcherInterface $eventDispatcher,
|
private readonly EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper,
|
private readonly AuthorizationHelper $authorizationHelper,
|
||||||
PaginatorFactory $paginator
|
private readonly PaginatorFactory $paginator,
|
||||||
) {
|
private readonly TranslatorInterface $translator
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
) {}
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
|
||||||
$this->paginator = $paginator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new report for a given person and of a given type.
|
* Create a new report for a given person and of a given type.
|
||||||
@ -98,7 +81,7 @@ class ReportController extends AbstractController
|
|||||||
->getFlashBag()
|
->getFlashBag()
|
||||||
->add(
|
->add(
|
||||||
'success',
|
'success',
|
||||||
$this->get('translator')
|
$this->translator
|
||||||
->trans('Success : report created!')
|
->trans('Success : report created!')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -108,7 +91,7 @@ class ReportController extends AbstractController
|
|||||||
$this->get('session')
|
$this->get('session')
|
||||||
->getFlashBag()->add(
|
->getFlashBag()->add(
|
||||||
'error',
|
'error',
|
||||||
$this->get('translator')
|
$this->translator
|
||||||
->trans('The form is not valid. The report has not been created !')
|
->trans('The form is not valid. The report has not been created !')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -135,11 +118,11 @@ class ReportController extends AbstractController
|
|||||||
$report = $em->getRepository('ChillReportBundle:Report')->find($report_id);
|
$report = $em->getRepository('ChillReportBundle:Report')->find($report_id);
|
||||||
|
|
||||||
if (!$report) {
|
if (!$report) {
|
||||||
throw $this->createNotFoundException($this->get('translator')->trans('Unable to find this report.'));
|
throw $this->createNotFoundException($this->translator->trans('Unable to find this report.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((int) $person_id !== (int) $report->getPerson()->getId()) {
|
if ((int) $person_id !== (int) $report->getPerson()->getId()) {
|
||||||
throw new \RuntimeException($this->get('translator')->trans('This is not the report of the person.'), 1);
|
throw new \RuntimeException($this->translator->trans('This is not the report of the person.'), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_REPORT_UPDATE', $report);
|
$this->denyAccessUnlessGranted('CHILL_REPORT_UPDATE', $report);
|
||||||
@ -418,7 +401,7 @@ class ReportController extends AbstractController
|
|||||||
$report = $em->getRepository('ChillReportBundle:Report')->find($report_id);
|
$report = $em->getRepository('ChillReportBundle:Report')->find($report_id);
|
||||||
|
|
||||||
if (!$report) {
|
if (!$report) {
|
||||||
throw $this->createNotFoundException($this->get('translator')->trans('Unable to find this report.'));
|
throw $this->createNotFoundException($this->translator->trans('Unable to find this report.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_REPORT_UPDATE', $report);
|
$this->denyAccessUnlessGranted('CHILL_REPORT_UPDATE', $report);
|
||||||
@ -433,7 +416,7 @@ class ReportController extends AbstractController
|
|||||||
->getFlashBag()
|
->getFlashBag()
|
||||||
->add(
|
->add(
|
||||||
'success',
|
'success',
|
||||||
$this->get('translator')
|
$this->translator
|
||||||
->trans('Success : report updated!')
|
->trans('Success : report updated!')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -453,7 +436,7 @@ class ReportController extends AbstractController
|
|||||||
->getFlashBag()
|
->getFlashBag()
|
||||||
->add(
|
->add(
|
||||||
'error',
|
'error',
|
||||||
$this->get('translator')
|
$this->translator
|
||||||
->trans('The form is not valid. The report has not been updated !')
|
->trans('The form is not valid. The report has not been updated !')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -480,7 +463,7 @@ class ReportController extends AbstractController
|
|||||||
$entity = $em->getRepository('ChillReportBundle:Report')->find($report_id);
|
$entity = $em->getRepository('ChillReportBundle:Report')->find($report_id);
|
||||||
|
|
||||||
if (!$entity || !$person) {
|
if (!$entity || !$person) {
|
||||||
throw $this->createNotFoundException($this->get('translator')->trans('Unable to find this report.'));
|
throw $this->createNotFoundException($this->translator->trans('Unable to find this report.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_REPORT_SEE', $entity);
|
$this->denyAccessUnlessGranted('CHILL_REPORT_SEE', $entity);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user