samedi 28 mars 2015

symfony form entity update

I'm trying to create a for with an entity.


My controller:



$questionnaire = $em->getRepository('questionnaireBundle:questionnaire')->findOneBy(array('id' => $id));

$form = $this->createForm(new questionnaireType(), $questionnaire);


QuestionnaireType:



public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add('nom', 'text', array('label' => 'Nom:'));
$builder->add('nbreQuestions', 'text', array('label' => 'Nombre de questions:'));
$builder->add('type', 'entity', array('class' => 'questionnaireBundle:type', 'property' => 'type'));
$builder->add('envoyer', 'submit', array('label' => 'Enregistrer', 'attr' => array('class' => 'btn btn-success col-md-12')));
}


The field nom, nbreQuestions will automatically be fully with the entity questionnaire, but type is not update!


Anybody knows why?


Thanks Best regards


Aucun commentaire:

Enregistrer un commentaire