Symfony 3.14 createForm builder undefined method add

I am trying to validate reqest, so i am want to create form to do it.
i call below method in my controller

$form = $this->createForm(RecipientFormType::class);

RecipientFormType class

class RecipientFormType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
             >add('name')
            ->add('address')
            ->add('postCode')
            ->add('city')
        ;
    }
}

while calling createForm i get below message

Attempted to call function "add" from form namespace.
SymfonyComponentDebugExceptionUndefinedFunctionException

thanks for your help!

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *