How to access custom field value in Sonata Admin

916 views
Skip to first unread message

tcowin

unread,
Feb 2, 2012, 8:43:36 PM2/2/12
to sonata-users
I've added a custom field - not contained in the Entity - to a form
via

$formMapper
.....
->add('resolved', 'text' ,array("property_path" => false,'required' =>
false));

in configureFormFields in Admin.

It appears on the form fine, and I'm able to submit the form. I can
see the value of the submitted form field as a protected parameter in
the request object, yet I cannot determine how to access the value
from code in either Admin or AdminController.

I've tried:

$resolved = $this->get('request')->request->get('resolved');

$data = $form->getData();

among other things :)

Is it possible to access this value using SonataAdmin?

tcowin

unread,
Feb 3, 2012, 5:50:34 PM2/3/12
to sonata-users
Well, I guess I'll answer my own question - I could not find what
appeared to be an accepted way to accomplish this, so with a little
hackery, I was able to obtain it in the AdminController with:

$resolved = $_REQUEST[$_REQUEST['uniqid']]["resolved"];

Thomas Rabaix

unread,
Feb 3, 2012, 6:00:11 PM2/3/12
to sonata...@googlegroups.com
This issue is more a Symfony Form component issue ... nothing to do with the AdminBundle


--
You received this message because you are subscribed to the Google Groups "sonata-users" group.
To post to this group, send email to sonata...@googlegroups.com.
To unsubscribe from this group, send email to sonata-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sonata-users?hl=en.




--
Thomas Rabaix
http://rabaix.net | http://sonata-project.org

Reply all
Reply to author
Forward
0 new messages