@@ -1024,7 +1024,7 @@ In :ref:`book-form-creating-form-classes` you will learn how to move the
10241024form building code into separate classes. When using an external form class
10251025in the controller, you can pass the action and method as form options::
10261026
1027- use AppBundle\Form\Type\ TaskType;
1027+ use AppBundle\Form\TaskType;
10281028 // ...
10291029
10301030 $form = $this->createForm(TaskType::class, $task, array(
@@ -1074,8 +1074,8 @@ However, a better practice is to build the form in a separate, standalone PHP
10741074class, which can then be reused anywhere in your application. Create a new class
10751075that will house the logic for building the task form::
10761076
1077- // src/AppBundle/Form/Type/ TaskType.php
1078- namespace AppBundle\Form\Type ;
1077+ // src/AppBundle/Form/TaskType.php
1078+ namespace AppBundle\Form;
10791079
10801080 use Symfony\Component\Form\AbstractType;
10811081 use Symfony\Component\Form\FormBuilderInterface;
@@ -1097,7 +1097,7 @@ This new class contains all the directions needed to create the task form. It ca
10971097be used to quickly build a form object in the controller::
10981098
10991099 // src/AppBundle/Controller/DefaultController.php
1100- use AppBundle\Form\Type\ TaskType;
1100+ use AppBundle\Form\TaskType;
11011101
11021102 public function newAction()
11031103 {
@@ -1218,7 +1218,7 @@ Define your form type as a service.
12181218 # src/AppBundle/Resources/config/services.yml
12191219 services :
12201220 app.form.type.task :
1221- class : AppBundle\Form\Type\ TaskType
1221+ class : AppBundle\Form\TaskType
12221222 arguments : ["@app.my_service"]
12231223 tags :
12241224 - { name: form.type }
@@ -1232,7 +1232,7 @@ Define your form type as a service.
12321232 xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
12331233
12341234 <services >
1235- <service id =" app.form.type.task" class =" AppBundle\Form\Type\ TaskType" >
1235+ <service id =" app.form.type.task" class =" AppBundle\Form\TaskType" >
12361236 <tag name =" form.type" />
12371237 <argument type =" service" id =" app.my_service" ></argument >
12381238 </service >
@@ -1244,7 +1244,7 @@ Define your form type as a service.
12441244 // src/AppBundle/Resources/config/services.php
12451245 use Symfony\Component\DependencyInjection\Reference;
12461246
1247- $container->register('app.form.type.task', 'AppBundle\Form\Type\ TaskType')
1247+ $container->register('app.form.type.task', 'AppBundle\Form\TaskType')
12481248 ->addArgument(new Reference('app.my_service'))
12491249 ->addTag('form.type')
12501250
@@ -1352,8 +1352,8 @@ Next, add a new ``category`` property to the ``Task`` class::
13521352Now that your application has been updated to reflect the new requirements,
13531353create a form class so that a ``Category `` object can be modified by the user::
13541354
1355- // src/AppBundle/Form/Type/ CategoryType.php
1356- namespace AppBundle\Form\Type ;
1355+ // src/AppBundle/Form/CategoryType.php
1356+ namespace AppBundle\Form;
13571357
13581358 use Symfony\Component\Form\AbstractType;
13591359 use Symfony\Component\Form\FormBuilderInterface;
@@ -1377,12 +1377,10 @@ create a form class so that a ``Category`` object can be modified by the user::
13771377The end goal is to allow the ``Category `` of a ``Task `` to be modified right
13781378inside the task form itself. To accomplish this, add a ``category `` field
13791379to the ``TaskType `` object whose type is an instance of the new ``CategoryType ``
1380- class:
1381-
1382- .. code-block :: php
1380+ class::
13831381
13841382 use Symfony\Component\Form\FormBuilderInterface;
1385- use AppBundle\Form\Type\ CategoryType;
1383+ use AppBundle\Form\CategoryType;
13861384
13871385 public function buildForm(FormBuilderInterface $builder, array $options)
13881386 {
0 commit comments