Skip to content

Commit 6e0db1b

Browse files
committed
minor #6059 Add best practice about the Form type namespace (WouterJ)
This PR was merged into the 2.3 branch. Discussion ---------- Add best practice about the Form type namespace | Q | A | --- | --- | Doc fix? | no | New docs? | yes | Applies to | all | Fixed tickets | - /cc @javiereguiluz @weaverryan as you are the main guys behind this guide. Commits ------- 0275bef Add best practice about the Form type namespace
2 parents b1688d0 + 0275bef commit 6e0db1b

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)