1
我想了两个附加字段添加到窗体:Symfony3 allow_extra_fields
$this->contactForm = $this->createFormBuilder($contact, array('allow_extra_fields' =>true))
->add('Nom', TextType::class)
->add('Prenom', TextType::class)
->add('Telephone', TextType::class, array(
'label' => 'Téléphone'))
->add('Email', TextType::class)
->add('Ajouter', SubmitType::class)
->getForm();
但我得到这个错误:
Neither the property "Nom" nor one of the methods "getNom()", "nom()", "isNom()", "hasNom()", "__get()" exist and have public access in class "CommonBundle\Entity\Contact".
如何避免这个错误?
感谢您的帮助。 –