mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix if condition in CalendarController + phpStan error
This commit is contained in:
parent
e1b6fb2db1
commit
77a6e92f69
@ -30,6 +30,7 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTimeImmutable;
|
||||
use Exception;
|
||||
use http\Exception\UnexpectedValueException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@ -178,7 +179,7 @@ class CalendarController extends AbstractController
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item updated!'));
|
||||
|
||||
if ($form->get('save_and_create_doc')->isClicked()) {
|
||||
if ($form->has('save_and_create_doc') && $form->get('save_and_create_doc')->isClicked()) {
|
||||
return $this->redirectToRoute('chill_calendar_calendardoc_pick_template', ['id' => $entity->getId()]);
|
||||
}
|
||||
|
||||
@ -302,6 +303,8 @@ class CalendarController extends AbstractController
|
||||
|
||||
$entity = new Calendar();
|
||||
|
||||
$redirectRoute = '';
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$view = '@ChillCalendar/Calendar/newByAccompanyingCourse.html.twig';
|
||||
$entity->setAccompanyingPeriod($accompanyingPeriod);
|
||||
@ -331,11 +334,15 @@ class CalendarController extends AbstractController
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item created!'));
|
||||
|
||||
if ($form->get('save_and_create_doc')->isClicked()) {
|
||||
if ($form->has('save_and_create_doc') && $form->get('save_and_create_doc')->isClicked()) {
|
||||
return $this->redirectToRoute('chill_calendar_calendardoc_pick_template', ['id' => $entity->getId()]);
|
||||
}
|
||||
|
||||
return new RedirectResponse($redirectRoute);
|
||||
if ('' !== $redirectRoute) {
|
||||
return new RedirectResponse($redirectRoute);
|
||||
}
|
||||
|
||||
throw new UnexpectedValueException('No person id or accompanying period id was given');
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user