8000 minor #7321 Made unmapped field example in forms chapter more descrip… · symfony/symfony-docs@dcad7f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit dcad7f1

Browse files
committed
minor #7321 Made unmapped field example in forms chapter more descriptive (hvt)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #7321). Discussion ---------- Made unmapped field example in forms chapter more descriptive Commits ------- 2d82707 Made unmapped field example in forms chapter more descriptive
2 parents 6cd0063 + 2d82707 commit dcad7f1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

forms.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,8 @@ the choice is ultimately up to you.
686686
{
687687
$builder
688688
->add('task')
689-
->add('dueDate', null, array('mapped' => false))
689+
->add('dueDate')
690+
->add('agreeTerms', 'checkbox', array('mapped' => false))
690691
->add('save', 'submit')
691692
;
692693
}
@@ -696,11 +697,11 @@ the choice is ultimately up to you.
696697

697698
The field data can be accessed in a controller with::
698699

699-
$form->get('dueDate')->getData();
700+
$form->get('agreeTerms')->getData();
700701

701702
In addition, the data of an unmapped field can also be modified directly::
702703

703-
$form->get('dueDate 53D7 ')->setData(new \DateTime());
704+
$form->get('agreeTerms')->setData(true);
704705

705706
Final Thoughts
706707
--------------

0 commit comments

Comments
 (0)
0