This is part of my entity class :
/**
* @var integer
*
* @ORM\Column(name="student", type="integer", nullable=true)
*/
private $student;
This part of my form class :
$builder
->add('student', 'choice', ['label'=> false,
'expanded' => true,
'choices' => (Array)new StudentEnum(),
])
;
Ad this is output :
<input id="xxxxx_0" type="radio" value="4" required="required" name="xxxxx[student]">
<label class="required" for="xxxxxV_student_0">Nie</label>
...
My problem is that my input tag should not have attribute "required" becouse I have set nullable=true in entity.
The solution is required => false
and empty_value => false
$builder
->add('student', 'choice', [
'label'=> false,
'expanded' => true,
'choices' => (Array)new StudentEnum(),
'required' => false,
'empty_value' => false
]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With