@@ -126,9 +126,10 @@ represented by its fully qualified class name. Among other things, it determines
126
126
which HTML form tag(s) is rendered for that field.
127
127
128
128
.. versionadded :: 2.8
129
- To denote the form type, you have to use the fully qualified class name.
130
- Before Symfony 2.8, you could use an alias for each type like ``'name' `` or
131
- ``'date' ``.
129
+ To denote the form type, you have to use the fully qualified class name - like
130
+ TextType::class in PHP 5.5+ or ``Symfony\Component\Form\Extension\Core\Type\TextType ``.
131
+ Before Symfony 2.8, you could use an alias for each type like ``text `` or
132
+ ``date ``. For more details, see the `2.8 UPGRADE Log `_.
132
133
133
134
Finally, you added a submit button with a custom label for submitting the form to
134
135
the server.
@@ -1230,18 +1231,11 @@ Define your form type as a service.
1230
1231
.. code-block :: php
1231
1232
1232
1233
// src/AppBundle/Resources/config/services.php
1233
- use AppBundle\Form\Type\TaskType ;
1234
+ use ;
1234
1235
1235
- $definition = new Definition(TaskType::class, array(
1236
- new Reference('app.my_service'),
1237
- ));
1238
- $container
1239
- ->setDefinition(
1240
- 'app.form.type.task',
1241
- $definition
1242
- )
1236
+ $container->register('app.form.type.task', 'AppBundle\Form\Type\TaskType')
1237
+ ->addArgument(new Reference('app.my_service'))
1243
1238
->addTag('form.type')
1244
- ;
1245
1239
1246
1240
Read :ref: `form-cookbook-form-field-service ` for more information.
1247
1241
@@ -1978,3 +1972,4 @@ Learn more from the Cookbook
1978
1972
.. _`form_div_layout.html.twig` : https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
1979
1973
.. _`Cross-site request forgery` : http://en.wikipedia.org/wiki/Cross-site_request_forgery
1980
1974
.. _`view on GitHub` : https://github.com/symfony/symfony/tree/master/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form
1975
+ .. _`2.8 UPGRADE Log` : https://github.com/symfony/symfony/blob/2.8/UPGRADE-2.8.md#form
0 commit comments