Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3924

PHP Symfony 4.4.5 Error: Could not load type "Doctrine\DBAL\Types\DateType": class does not implement "Symfony\Component\Form\FormTypeInterface"

$
0
0

I am trying to do a Symfony 4 tutorial and I am trying to create a form and it is saying that my class does not implement "Symfony\Component\Form\FormType" even though my class implements FormTypeInterface:

<?php

namespace App\Form;

use Doctrine\DBAL\Types\DateType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\FormTypeInterface;

class ContactType extends AbstractType implements FormTypeInterface{
    public function buildForm(FormBuilderInterface $builder, array $options){
        $builder
            ->add('name', TextareaType::class)
            ->add('email', EmailType::class)
            ->add('dateOfBirth', DateType::class)
            ->add('message', TextareaType::class)
            ;
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            // Configure your form options here
        ]);
    }
}

What do I need to do to make this work?


Viewing all articles
Browse latest Browse all 3924

Trending Articles