Skip to content

Commit 3b14460

Browse files
committed
Added a help note about isSubmitted method
1 parent 59a686e commit 3b14460

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/AppBundle/Controller/Admin/BlogController.php

+4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ public function newAction(Request $request)
7070

7171
$form->handleRequest($request);
7272

73+
// the isSubmitted() method is completely optional because the other
74+
// isValid() method already checks whether the form is submitted.
75+
// However, we explicitly add it to improve code readability.
76+
// See http://symfony.com/doc/current/best_practices/forms.html#handling-form-submits
7377
if ($form->isSubmitted() && $form->isValid()) {
7478
$post->setSlug($this->get('slugger')->slugify($post->getTitle()));
7579

0 commit comments

Comments
 (0)