Skip to content

Commit 162816f

Browse files
committed
Update forms.rst
Accessing form values via `vars` property instead of getter. Updated PHP templating examples.
1 parent 0428c57 commit 162816f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

book/forms.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ output can be customized on many different levels.
784784
785785
.. code-block:: html+php
786786

787-
<?php echo $view['form']->get('value')->getTask() ?>
787+
<?php echo $form->vars['value']->getTask() ?>
788788

789789
.. index::
790790
single: Forms; Rendering each field by hand
@@ -890,7 +890,7 @@ to get the ``id``:
890890

891891
.. code-block:: html+php
892892

893-
<?php echo $form['task']->get('id') ?>
893+
<?php echo $form['task']['vars']['id']?>
894894

895895
To get the value used for the form field's name attribute you need to use
896896
the ``full_name`` value:
@@ -903,7 +903,7 @@ the ``full_name`` value:
903903

904904
.. code-block:: html+php
905905

906-
<?php echo $form['task']->get('full_name') ?>
906+
<?php echo $form['task']['vars']['full_name'] ?>
907907

908908
Twig Template Function Reference
909909
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1085,7 +1085,7 @@ the choice is ultimately up to you.
10851085
The field data can be accessed in a controller with::
10861086

10871087
$form->get('dueDate')->getData();
1088-
1088+
10891089
In addition, the data of an unmapped field can also be modified directly::
10901090

10911091
$form->get('dueDate')->setData(new \DateTime());

0 commit comments

Comments
 (0)