Reputation: 31
hey i have my form and then an errour shows me i did my controller and path right /*
namespace DataBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\SubmitButton;
//Ive got my use use Symfony\Component\OptionsResolver\OptionsResolver;
class VoitureType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('immatricule')->add('marque')->add('modele')->add('typecarburant')->add('nbcheveaux')->add('datemarche')->add('nbrPlace')
->add('Ajouter',SubmitButton::class) ;
//it seems like here is the error
//thats for my car entity
;
}
*/
Upvotes: 1
Views: 455
Reputation: 881
Don't use SubmitButton as a type. The right type is SubmitType
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
// ...
->add('Ajouter',SubmitType::class);
By the way, Symfony consider as a best practice to not put the submit button in the form class.
Best Practice
Add buttons in the templates, not in the form classes or the controllers.
Upvotes: 3