mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
sa: Fix all issues related to PHP versions and static-analysis.
This commit is contained in:
@@ -19,6 +19,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use function array_key_exists;
|
||||
@@ -37,6 +38,7 @@ class AccompanyingCourseCommentController extends AbstractController
|
||||
$newComment->setAccompanyingPeriod($accompanyingCourse);
|
||||
|
||||
$form = $this->createCommentForm($newComment, 'new');
|
||||
$editForm = null;
|
||||
|
||||
if ($request->query->has('edit')) {
|
||||
foreach ($accompanyingCourse->getComments() as $comment) {
|
||||
@@ -53,12 +55,16 @@ class AccompanyingCourseCommentController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
if (null === $editForm) {
|
||||
throw new NotFoundHttpException('Unable to find an edit form.');
|
||||
}
|
||||
|
||||
if ($request->getMethod() === Request::METHOD_POST) {
|
||||
$currentForm = $editForm->handleRequest($request);
|
||||
|
||||
if (array_key_exists('edit', $request->request->all()[$editForm->getName()])) {
|
||||
$currentForm = $editForm->handleRequest($request);
|
||||
$isEditingNew = false;
|
||||
} else {
|
||||
$currentForm = $form->handleRequest($request);
|
||||
$isEditingNew = true;
|
||||
}
|
||||
|
||||
@@ -79,7 +85,7 @@ class AccompanyingCourseCommentController extends AbstractController
|
||||
return $this->render('@ChillPerson/AccompanyingCourse/comment_list.html.twig', [
|
||||
'accompanyingCourse' => $accompanyingCourse,
|
||||
'form' => $form->createView(),
|
||||
'edit_form' => isset($editForm) ? $editForm->createView() : null,
|
||||
'edit_form' => $editForm !== null ? $editForm->createView() : null,
|
||||
'commentEditId' => $commentEditId ?? null,
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user