Closed
Description
When adding radio elements to the form and the requets is being bind to the form, the following error appears:
_Warning: array_replace_recursive(): Argument #1 is not an array in /.../vendor/symfony/src/Symfony/Component/Form/Form.php line 583_
Here is an example code:
<?php
namespace My\Bundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
class TestController extends Controller
{
public function testAction(Request $request)
{
$form = $this->createFormBuilder()
->add('test', 'text')
->add('test2', 'radio')
->add('test3', 'radio')
->getForm();
if ($request->getMethod() == 'POST') {
$form->bindRequest($request);
}
return $this->render('MyBundle:Test:form.html.twig', array(
'form' => $form->createView(),
));
}
}