Answer the question
In order to leave comments, you need to log in
How to fix an error when creating a form in Symfony 3?
I am getting an error while creating the form. Expected argument of type "string", "form path" given
500 Internal Server Error - UnexpectedTypeException. Googling hasn't turned up anything yet, maybe someone can help.
A piece of code in the controller:
$form = $this->createForm(new ConferenceType(), $conference, array(
'action' => $this->generateUrl('mcm_demo_collection_form'),
'method' => 'POST',
));
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'text', array(
'label' => 'Conference Name',
))
->add('speakers', 'collection', array(
'type' => new SpeakerType()
))
->add('save', 'submit', array(
'attr' => array(
'class' => 'btn btn-lg btn-success'
)
))
;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question