File tree 2 files changed +5
-4
lines changed
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.
685
685
{
686
686
$builder
687
687
->add('task')
688
- ->add('dueDate', null, array('mapped' => false))
688
+ ->add('dueDate')
689
+ ->add('agreeTerms', CheckboxType::class, array('mapped' => false))
689
690
->add('save', SubmitType::class)
690
691
;
691
692
}
@@ -695,11 +696,11 @@ the choice is ultimately up to you.
695
696
696
697
The field data can be accessed in a controller with::
697
698
698
- $form->get('dueDate ')->getData();
699
+ $form->get('agreeTerms ')->getData();
699
700
700
701
In addition, the data of an unmapped field can also be modified directly::
701
702
702
- $form->get('dueDate ')->setData(new \DateTime() );
703
+ $form->get('agreeTerms ')->setData(true );
703
704
704
705
Final Thoughts
705
706
--------------
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
81
81
needs::
82
82
83
83
// src/AppBundle/Tests/Controller/DefaultControllerTest.php
84
- namespace Appbundle \Tests\Controller;
84
+ namespace AppBundle \Tests\Controller;
85
85
86
86
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
87
87
use Symfony\Component\BrowserKit\Cookie;
You can’t perform that action at this time.
0 commit comments