Skip to content

Commit 0275bef

Browse files
committed
Add best practice about the Form type namespace
1 parent 9960f9c commit 0275bef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

best_practices/forms.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,17 @@ form in its own PHP class::
4949
}
5050
}
5151

52+
.. best-practice::
53+
54+
Put the form type classes in the ``AppBundle\Form`` namespace, unless you
55+
use other custom form classes like data transformers.
56+
5257
To use the class, use ``createForm`` and instantiate the new class::
5358

54-
use AppBundle\Form\PostType;
5559
// ...
60+
use AppBundle\Form\PostType;
5661

62+
// ...
5763
public function newAction(Request $request)
5864
{
5965
$post = new Post();

0 commit comments

Comments
 (0)