apply rector rules: symfony **UP TO** 44

This commit is contained in:
2023-07-28 01:52:53 +02:00
parent b6a094aeee
commit c20f65eebb
88 changed files with 211 additions and 320 deletions

View File

@@ -90,7 +90,7 @@ class ReportController extends AbstractController
$form = $this->createCreateForm($entity, $person, $cFGroup);
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$entity->setCFGroup($cFGroup);
$entity->setPerson($person);
@@ -107,10 +107,7 @@ class ReportController extends AbstractController
->trans('Success : report created!')
);
return $this->redirect($this->generateUrl(
'report_view',
['person_id' => $person_id, 'report_id' => $entity->getId()]
));
return $this->redirectToRoute('report_view', ['person_id' => $person_id, 'report_id' => $entity->getId()]);
}
$this->get('session')
@@ -166,7 +163,7 @@ class ReportController extends AbstractController
'element_id' => $report->getId(),
'action' => 'edit',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render('ChillReportBundle:Report:edit.html.twig', [
'edit_form' => $editForm->createView(),
@@ -247,7 +244,7 @@ class ReportController extends AbstractController
'element_class' => Report::class,
'action' => 'list',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render('ChillReportBundle:Report:list.html.twig', [
'reports' => $reports,
@@ -335,24 +332,14 @@ class ReportController extends AbstractController
$cFGroupId = $request->query->get('cFGroup');
if ($request->query->has('cFGroup')) {
return $this->redirect(
$this->generateUrl(
'report_new',
['person_id' => $person_id, 'cf_group_id' => $cFGroupId]
)
);
return $this->redirectToRoute('report_new', ['person_id' => $person_id, 'cf_group_id' => $cFGroupId]);
}
$cFGroups = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->findByEntity(\Chill\ReportBundle\Entity\Report::class);
if (count($cFGroups) === 1) {
return $this->redirect(
$this->generateUrl(
'report_new',
['person_id' => $person_id, 'cf_group_id' => $cFGroups[0]->getId()]
)
);
return $this->redirectToRoute('report_new', ['person_id' => $person_id, 'cf_group_id' => $cFGroups[0]->getId()]);
}
$cFGroupsChoice = [];
@@ -392,12 +379,7 @@ class ReportController extends AbstractController
$cFGroupId = $request->query->get('cFGroup');
if ($request->query->has('cFGroup')) {
return $this->redirect(
$this->generateUrl(
'report_export_list',
['cf_group_id' => $cFGroupId]
)
);
return $this->redirectToRoute('report_export_list', ['cf_group_id' => $cFGroupId]);
}
$em = $this->getDoctrine()->getManager();
@@ -406,12 +388,7 @@ class ReportController extends AbstractController
->findByEntity(\Chill\ReportBundle\Entity\Report::class);
if (count($cFGroups) === 1) {
return $this->redirect(
$this->generateUrl(
'report_export_list',
['cf_group_id' => $cFGroups[0]->getId()]
)
);
return $this->redirectToRoute('report_export_list', ['cf_group_id' => $cFGroups[0]->getId()]);
}
$cFGroupsChoice = [];
@@ -461,7 +438,7 @@ class ReportController extends AbstractController
$editForm = $this->createEditForm($report);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush();
$this->get('session')
@@ -479,12 +456,9 @@ class ReportController extends AbstractController
'element_id' => $report->getId(),
'action' => 'update',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->redirect($this->generateUrl(
'report_view',
['person_id' => $report->getPerson()->getId(), 'report_id' => $report_id]
));
return $this->redirectToRoute('report_view', ['person_id' => $report->getPerson()->getId(), 'report_id' => $report_id]);
}
$this->get('session')
@@ -530,7 +504,7 @@ class ReportController extends AbstractController
'element_id' => $entity->getId(),
'action' => 'view',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render('ChillReportBundle:Report:view.html.twig', [
'entity' => $entity,