I am learning symfony2 and sonata admin and have encountered several problems, and this is one of them.
I created an admin class that extends the sonata administrator and below will not work for me:
$this->getForm()->get('page')
or
$this->getRequest()->request->get('page')
I am trying to pass some hidden fields to configureFormFields, but I cannot access them using the above after the form has been submitted. I see an array of requests, but it get('page')returns null. In addition, the array of queries is multidimensional.
Any advice is appreciated.
A simple example of what I'm trying to do is given below:
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('title')
->add(
'subobject',
'hidden',
array(
'mapped' => false,
'data' => 'sub'
)
)
;
}
public function prePersist($object)
{
$subobject_request = $this->getRequest()->request->get('subobject');
print_r($subobject_request);
die();
}
source
share