From 6da03aa23090a4e8a53872804993207f4db3ae69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Sun, 22 Oct 2023 12:59:56 +0200 Subject: [PATCH] Fix comment stating isSubmitted is optional --- src/Controller/Admin/BlogController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Controller/Admin/BlogController.php b/src/Controller/Admin/BlogController.php index 819e04e65..b40984a07 100644 --- a/src/Controller/Admin/BlogController.php +++ b/src/Controller/Admin/BlogController.php @@ -86,9 +86,8 @@ public function new( $form->handleRequest($request); - // the isSubmitted() method is completely optional because the other - // isValid() method already checks whether the form is submitted. - // However, we explicitly add it to improve code readability. + // The isSubmitted() call is mandatory because the isValid() method + // throws an exception if the form has not been submitted. // See https://symfony.com/doc/current/forms.html#processing-forms if ($form->isSubmitted() && $form->isValid()) { $entityManager->persist($post);