Skip to content

Commit 4799a7c

Browse files
committed
minor tweaks symfony#5834
1 parent 3ebf2d0 commit 4799a7c

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

book/forms.rst

+8-13
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,10 @@ represented by its fully qualified class name. Among other things, it determines
126126
which HTML form tag(s) is rendered for that field.
127127

128128
.. 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`_.
132133

133134
Finally, you added a submit button with a custom label for submitting the form to
134135
the server.
@@ -1230,18 +1231,11 @@ Define your form type as a service.
12301231
.. code-block:: php
12311232
12321233
// src/AppBundle/Resources/config/services.php
1233-
use AppBundle\Form\Type\TaskType;
1234+
use ;
12341235
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'))
12431238
->addTag('form.type')
1244-
;
12451239
12461240
Read :ref:`form-cookbook-form-field-service` for more information.
12471241

@@ -1978,3 +1972,4 @@ Learn more from the Cookbook
19781972
.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
19791973
.. _`Cross-site request forgery`: http://en.wikipedia.org/wiki/Cross-site_request_forgery
19801974
.. _`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

Comments
 (0)