File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -685,7 +685,8 @@ the choice is ultimately up to you.
685685 {
686686 $builder
687687 ->add('task')
688- ->add('dueDate', null, array('mapped' => false))
688+ ->add('dueDate')
689+ ->add('agreeTerms', CheckboxType::class, array('mapped' => false))
689690 ->add('save', SubmitType::class)
690691 ;
691692 }
@@ -695,11 +696,11 @@ the choice is ultimately up to you.
695696
696697 The field data can be accessed in a controller with::
697698
698- $form->get('dueDate ')->getData();
699+ $form->get('agreeTerms ')->getData();
699700
700701 In addition, the data of an unmapped field can also be modified directly::
701702
702- $form->get('dueDate ')->setData(new \DateTime() );
703+ $form->get('agreeTerms ')->setData(true );
703704
704705Final Thoughts
705706--------------
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ but the following example shows a complete example that you can adapt to your
8181needs::
8282
8383 // src/AppBundle/Tests/Controller/DefaultControllerTest.php
84- namespace Appbundle \Tests\Controller;
84+ namespace AppBundle \Tests\Controller;
8585
8686 use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
8787 use Symfony\Component\BrowserKit\Cookie;
You can’t perform that action at this time.
0 commit comments