Skip to content

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

Closed
wants to merge 4 commits into from
Closed

Added hint about modifying an unmapped form field #2949

wants to merge 4 commits into from

Conversation

peterrehm
Copy link
Contributor

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.

@@ -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 ::
Copy link
Member

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 ::

Copy link
Member

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 ...

@peterrehm
Copy link
Contributor Author

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::
Copy link
Member

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

@peterrehm
Copy link
Contributor Author

@xabbuh updated, thanks.

@xabbuh
Copy link
Member

xabbuh commented Sep 3, 2013

👍 This can be merged by @weaverryan in the 2.2 branch, I think. Or is this only related to the master branch?

@peterrehm
Copy link
Contributor Author

No, should be good for both.


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

$form->get('dueDate')->setData('dueDate');
Copy link
Member

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()); ?

@peterrehm
Copy link
Contributor Author

@weaverryan You are right. Updated per your request.

weaverryan added a commit that referenced this pull request Oct 1, 2013
@weaverryan
Copy link
Member

Awesome, thanks Peter! I've patched these commits into the 2.2 branch.

Thanks!

@weaverryan weaverryan closed this Oct 1, 2013
@peterrehm peterrehm deleted the patch-4 branch August 23, 2014 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants