Remove unnecessary comparison in ActivityController

This commit is contained in:
Julien Fastré 2023-08-02 16:25:44 +02:00
parent cd7b91dd98
commit 378e417d5c
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -77,6 +77,7 @@ final class ActivityController extends AbstractController
/** /**
* Deletes a Activity entity. * Deletes a Activity entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/delete", name="chill_activity_activity_delete", methods={"GET", "POST", "DELETE"})
*/ */
public function deleteAction(Request $request, mixed $id) public function deleteAction(Request $request, mixed $id)
{ {
@ -135,10 +136,6 @@ final class ActivityController extends AbstractController
} }
} }
if (null === $view) {
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, [ return $this->render($view, [
'activity' => $activity, 'activity' => $activity,
'delete_form' => $form->createView(), 'delete_form' => $form->createView(),
@ -149,6 +146,7 @@ final class ActivityController extends AbstractController
/** /**
* Displays a form to edit an existing Activity entity. * Displays a form to edit an existing Activity entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/edit", name="chill_activity_activity_edit", methods={"GET", "POST", "PUT"})
*/ */
public function editAction(int $id, Request $request): Response public function editAction(int $id, Request $request): Response
{ {
@ -228,10 +226,6 @@ final class ActivityController extends AbstractController
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
*/ */
if (null === $view) {
throw $this->createNotFoundException('Template not found');
}
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']); $activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
return $this->render($view, [ return $this->render($view, [
@ -246,6 +240,7 @@ final class ActivityController extends AbstractController
/** /**
* Lists all Activity entities. * Lists all Activity entities.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/", name="chill_activity_activity_list")
*/ */
public function listAction(Request $request): Response public function listAction(Request $request): Response
{ {
@ -351,6 +346,9 @@ final class ActivityController extends AbstractController
return $filterBuilder->build(); return $filterBuilder->build();
} }
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/new", name="chill_activity_activity_new", methods={"POST", "GET"})
*/
public function newAction(Request $request): Response public function newAction(Request $request): Response
{ {
$view = null; $view = null;
@ -531,6 +529,9 @@ final class ActivityController extends AbstractController
]); ]);
} }
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/select-type", name="chill_activity_activity_select_type")
*/
public function selectTypeAction(Request $request): Response public function selectTypeAction(Request $request): Response
{ {
$view = null; $view = null;
@ -575,6 +576,9 @@ final class ActivityController extends AbstractController
]); ]);
} }
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/show", name="chill_activity_activity_show")
*/
public function showAction(Request $request, int $id): Response public function showAction(Request $request, int $id): Response
{ {
$entity = $this->activityRepository->find($id); $entity = $this->activityRepository->find($id);
@ -614,10 +618,6 @@ final class ActivityController extends AbstractController
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
*/ */
if (null === $view) {
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, [ return $this->render($view, [
'person' => $person, 'person' => $person,
'accompanyingCourse' => $accompanyingPeriod, 'accompanyingCourse' => $accompanyingPeriod,