Stealthio Stealthio - 11 months ago 73
PHP Question

Could not load type "Gregwar\CaptchaBundle\Type\CaptchaType"

I'm using 1.1 & Symfony 2.3.42. I configured my form like this:

$builder->add('username', 'text')
->add('password', 'password')
->add('captcha', CaptchaType::class);

This error comes up:

Could not load type "Gregwar\CaptchaBundle\Type\CaptchaType"

According to the documentation, thats the right way to configure the captcha field.
Any help would be appreciated.

lin lin
Answer Source

I run into the same problem. First of all: Gregwar\CaptchaBundle does support Symfony >= 2.8 in its 1.x versions. If you using Symfony < 2.8 the documentation won't help you, because parsing the class as element type is not supported. The documentation helps if you are using Symfony => 2.8.

Gregwar/CaptchaBundle 1.* + Symfony < 2.8 use:

$builder->add('captcha', 'captcha');

Gregwar/CaptchaBundle 2.* + Symfony => 2.8 use:

$builder->add('captcha', CaptchaType::class);

... to define your form captcha input.