CaptchaBundle icon indicating copy to clipboard operation
CaptchaBundle copied to clipboard

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

Open kemoc opened this issue 9 years ago • 13 comments

error: Could not load type "Gregwar\CaptchaBundle\Type\CaptchaType" vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php at line 83

Symfony 2.7.8: Installed bundle by composer require gregwar/captcha-bundle

bundle registered: $bundles = array( // ... new Gregwar\CaptchaBundle\GregwarCaptchaBundle(), ); configured: gregwar_captcha: ~

$builder->add('captcha', 'Gregwar\CaptchaBundle\Type\CaptchaType');

composer.json: "gregwar/captcha-bundle": "^2.0"

kemoc avatar Jan 15 '16 14:01 kemoc

Hi.

He says

If you are using Symfony < 2.8, you should use version 1.*

So you should use "gregwar/captcha-bundle": "1.*". But I tried it on version 1.0 and it still shows the same error.

Unfortunately example is not correct or some step is missing.

strange

sewerp avatar Jan 16 '16 21:01 sewerp

Hello, I have the same problem, I'm using symfony 2.7 and Captcha Bundle 1.* and I get error: Could not load type "Gregwar\CaptchaBundle\Type\CaptchaType" can anyone help?

mariusz-cz avatar Jan 18 '16 11:01 mariusz-cz

I found solution:

  1. write in controller: $formBuilder = $this->createFormBuilder(); $formBuilder->add('captcha', 'captcha'); instead: $formBuilder->add('captcha', 'Gregwar\CaptchaBundle\Type\CaptchaType');
  2. Fix Gregwar\CaptchaBundle\Type\CaptchaType class public function getParent() { return 'text'; // Not using ::class to support Symfony 2.8 w/ php<5.5 //return 'Symfony\Component\Form\Extension\Core\Type\TextType'; }

kemoc avatar Jan 20 '16 08:01 kemoc

I use Symfony2.3 and he gives me the same error with the Bundles any version: Could not load type "Gregwar\CaptchaBundle\Type\CaptchaType"

fjmg avatar Feb 09 '16 21:02 fjmg

In sf <2.8 you should add a field of type "captcha" and in sf>=2.8 you should use CaptchaType::class Le 9 févr. 2016 22:02, "fjmg" [email protected] a écrit :

I use Symfony2.3 and he gives me the same error with the Bundles any version: Could not load type "Gregwar\CaptchaBundle\Type\CaptchaType"

— Reply to this email directly or view it on GitHub https://github.com/Gregwar/CaptchaBundle/issues/159#issuecomment-182066613 .

Gregwar avatar Feb 09 '16 21:02 Gregwar

Thanks to answer so fast. I already did the change and now it evidences this error to me: FatalErrorException: Error: Class 'Gregwar\Captcha\CaptchaBuilder' not found in /media/Datos/sitios/kefacil/sitio/app/cache/dev/appDevDebugProjectContainer.php line 1844

fjmg avatar Feb 09 '16 21:02 fjmg

Looks like composer didn't install the dependency with gregwar/captcha

You can give a try to composer install or something like this Le 9 févr. 2016 22:22, "fjmg" [email protected] a écrit :

Thanks to answer so fast. I already did the change and now it evidences this error to me: FatalErrorException: Error: Class 'Gregwar\Captcha\CaptchaBuilder' not found in /media/Datos/sitios/kefacil/sitio/app/cache/dev/appDevDebugProjectContainer.php line 1844

— Reply to this email directly or view it on GitHub https://github.com/Gregwar/CaptchaBundle/issues/159#issuecomment-182072867 .

Gregwar avatar Feb 09 '16 21:02 Gregwar

Install the bundle within reach. From now on I put the steps that I followed to install the bundle to him "vendor\composer\autoload_namespaces.php"

array($vendorDir . '/bundles'), ' ' => array($baseDir . '/src'), ); ``` ?>

"app\AppKernel.php" new Gregwar\CaptchaBundle\GregwarCaptchaBundle(),

Thank you very much for help

fjmg avatar Feb 09 '16 21:02 fjmg

What happen when you run composer install?

Gregwar avatar Feb 09 '16 21:02 Gregwar

The connection of internet is very bad. When I try to install with composer the connection time to it he expires to me. It went for me but easy discharging the bundle.

fjmg avatar Feb 09 '16 21:02 fjmg

dont work

Avtonom avatar Jun 17 '16 14:06 Avtonom

require 'vendor/autoload.php'; use Gregwar\Captcha\CaptchaBuilder;

This works

idax avatar Sep 21 '17 07:09 idax

require 'vendor/autoload.php'; use Gregwar\Captcha\CaptchaBuilder;

Esto funciona muchas gracias ya me funciono a mi

Died1 avatar Jun 29 '19 02:06 Died1