rdv: minor corrections following MR review

This commit is contained in:
nobohan
2021-07-23 10:14:20 +02:00
parent df7e76a2e7
commit cc3e7f54a7
5 changed files with 49 additions and 44 deletions

View File

@@ -93,11 +93,11 @@ class CalendarController extends AbstractController
$view = 'ChillCalendarBundle:Calendar:listByAccompanyingCourse.html.twig';
}
return $this->render($view, array(
return $this->render($view, [
'calendarItems' => $calendarItems,
'user' => $user,
'accompanyingCourse' => $accompanyingPeriod,
));
]);
}
/**
@@ -143,8 +143,11 @@ class CalendarController extends AbstractController
$params['id'] = $entity->getId();
return $this->redirectToRoute('chill_calendar_calendar_show', $params);
} elseif ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
}
if ($view === null) {
throw $this->createNotFoundException('Template not found');
}
@@ -194,12 +197,12 @@ class CalendarController extends AbstractController
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, array(
return $this->render($view, [
//'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'entity' => $entity,
//'delete_form' => $deleteForm->createView(),
));
]);
}
@@ -240,6 +243,8 @@ class CalendarController extends AbstractController
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
$params['id'] = $id;
return $this->redirectToRoute('chill_activity_activity_show', $params);
} elseif ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
}
$deleteForm = $this->createDeleteForm($id, $user, $accompanyingPeriod);
@@ -250,13 +255,13 @@ class CalendarController extends AbstractController
$entity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
return $this->render($view, array(
return $this->render($view, [
'entity' => $entity,
'form' => $form->createView(),
'delete_form' => $deleteForm->createView(),
'accompanyingCourse' => $accompanyingPeriod,
'entity_json' => $entity_array
));
]);
}
/**
@@ -290,10 +295,10 @@ class CalendarController extends AbstractController
if ($form->isValid()) {
$this->logger->notice("A calendar event has been removed", array(
$this->logger->notice("A calendar event has been removed", [
'by_user' => $this->getUser()->getUsername(),
'calendar_id' => $entity->getId()
));
]);
$em->remove($entity);
$em->flush();
@@ -310,11 +315,11 @@ class CalendarController extends AbstractController
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, array(
return $this->render($view, [
'calendar' => $entity,
'delete_form' => $form->createView(),
'accompanyingCourse' => $accompanyingPeriod,
));
]);
}
/**
@@ -328,7 +333,7 @@ class CalendarController extends AbstractController
return $this->createFormBuilder()
->setAction($this->generateUrl('chill_calendar_calendar_delete', $params))
->setMethod('DELETE')
->add('submit', SubmitType::class, array('label' => 'Delete'))
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm()
;
}