New to symfony2, I have a simple table with 2 fields.
As alert field is a boolean, I declared the form like this:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('message', 'text', array('label' => "Message"))
->add('alert', 'choice', array(
'choices' => array(1 => 'Yes', 0 => 'No'),
'expanded' => true,
'multiple' => false,
'label' => "Are you agree?",
'attr' => array('class' => 'well')
));
}
It is working when I create a new entry, but when I am trying to edit the entry, the 'alert' choice stored in database is not set in the form (radio button).
How can I set the database state of the field in the form?