8000 Made unmapped field example in forms chapter more descriptive by hvt · Pull Request #7321 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Made unmapped field example in forms chapter more descriptive #7321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@ the choice is ultimately up to you.
{
$builder
->add('task')
->add('dueDate', null, array('mapped' => false))
->add('dueDate')
->add('agreeTerms', CheckboxType::class, array('mapped' => false))
->add('save', SubmitType::class)
;
}
Expand All @@ -677,11 +678,11 @@ the choice is ultimately up to you.

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

$form->get('dueDate')->getData();
$form->get('agreeTerms')->getData();

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

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

Final Thoughts
--------------
Expand Down
0