@@ -992,7 +992,7 @@ In :ref:`book-form-creating-form-classes` you will learn how to move the
992992form building code into separate classes. When using an external form class
993993in the controller, you can pass the action and method as form options::
994994
995- use AppBundle\Form\Type\ TaskType;
995+ use AppBundle\Form\TaskType;
996996 // ...
997997
998998 $form = $this->createForm(TaskType::class, $task, array(
@@ -1040,8 +1040,8 @@ However, a better practice is to build the form in a separate, standalone PHP
10401040class, which can then be reused anywhere in your application. Create a new class
10411041that will house the logic for building the task form::
10421042
1043- // src/AppBundle/Form/Type/ TaskType.php
1044- namespace AppBundle\Form\Type ;
1043+ // src/AppBundle/Form/TaskType.php
1044+ namespace AppBundle\Form;
10451045
10461046 use Symfony\Component\Form\AbstractType;
10471047 use Symfony\Component\Form\FormBuilderInterface;
@@ -1063,7 +1063,7 @@ This new class contains all the directions needed to create the task form. It ca
10631063be used to quickly build a form object in the controller::
10641064
10651065 // src/AppBundle/Controller/DefaultController.php
1066- use AppBundle\Form\Type\ TaskType;
1066+ use AppBundle\Form\TaskType;
10671067
10681068 public function newAction()
10691069 {
@@ -1184,7 +1184,7 @@ Define your form type as a service.
11841184 # src/AppBundle/Resources/config/services.yml
11851185 services :
11861186 app.form.type.task :
1187- class : AppBundle\Form\Type\ TaskType
1187+ class : AppBundle\Form\TaskType
11881188 arguments : ["@app.my_service"]
11891189 tags :
11901190 - { name: form.type }
@@ -1198,7 +1198,7 @@ Define your form type as a service.
11981198 xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
11991199
12001200 <services >
1201- <service id =" app.form.type.task" class =" AppBundle\Form\Type\ TaskType" >
1201+ <service id =" app.form.type.task" class =" AppBundle\Form\TaskType" >
12021202 <tag name =" form.type" />
12031203 <argument type =" service" id =" app.my_service" ></argument >
12041204 </service >
@@ -1210,7 +1210,7 @@ Define your form type as a service.
12101210 // src/AppBundle/Resources/config/services.php
12111211 use Symfony\Component\DependencyInjection\Reference;
12121212
1213- $container->register('app.form.type.task', 'AppBundle\Form\Type\ TaskType')
1213+ $container->register('app.form.type.task', 'AppBundle\Form\TaskType')
12141214 ->addArgument(new Reference('app.my_service'))
12151215 ->addTag('form.type')
12161216
@@ -1318,8 +1318,8 @@ Next, add a new ``category`` property to the ``Task`` class::
13181318Now that your application has been updated to reflect the new requirements,
13191319create a form class so that a ``Category `` object can be modified by the user::
13201320
1321- // src/AppBundle/Form/Type/ CategoryType.php
1322- namespace AppBundle\Form\Type ;
1321+ // src/AppBundle/Form/CategoryType.php
1322+ namespace AppBundle\Form;
13231323
13241324 use Symfony\Component\Form\AbstractType;
13251325 use Symfony\Component\Form\FormBuilderInterface;
@@ -1343,12 +1343,10 @@ create a form class so that a ``Category`` object can be modified by the user::
13431343The end goal is to allow the ``Category `` of a ``Task `` to be modified right
13441344inside the task form itself. To accomplish this, add a ``category `` field
13451345to the ``TaskType `` object whose type is an instance of the new ``CategoryType ``
1346- class:
1347-
1348- .. code-block :: php
1346+ class::
13491347
13501348 use Symfony\Component\Form\FormBuilderInterface;
1351- use AppBundle\Form\Type\ CategoryType;
1349+ use AppBundle\Form\CategoryType;
13521350
13531351 public function buildForm(FormBuilderInterface $builder, array $options)
13541352 {
0 commit comments