-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added hint about modifying an unmapped form field #2949
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
Conversation
@@ -1075,6 +1075,10 @@ the choice is ultimately up to you. | |||
The field data can be accessed in a controller with:: | |||
|
|||
$form->get('dueDate')->getData(); | |||
|
|||
In addition the data of a unmapped field can also directly be modified :: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should remove the space before ::
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition, the data of an unmapped field ...
Thanks for the feedback and English correction :) Has just been updated. |
@@ -1075,6 +1075,10 @@ the choice is ultimately up to you. | |||
The field data can be accessed in a controller with:: | |||
|
|||
$form->get('dueDate')->getData(); | |||
|
|||
In addition, the data of an unmapped field can also directly be modified:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe can also be modified directly
is a little bit better
@xabbuh updated, thanks. |
👍 This can be merged by @weaverryan in the |
No, should be good for both. |
|
||
In addition, the data of an unmapped field can also be modified directly:: | ||
|
||
$form->get('dueDate')->setData('dueDate'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a funny example :), shouldn't it be something more like? ->setData(new \DateTime());
?
@weaverryan You are right. Updated per your request. |
Added information how to modify the data of an unmapped form field.
This is especially important if you created the form based on an entity but add some unmapped fields where you want to handle the data.