I'm using Symfony Standard Edition, and everything work in the version of Symfony2.X until I update it to the 3.0.x-dev.
Even in the newer version, everything works except a page that give me an error in the Controller:
Could not load type "text" 500 Internal Server Error - InvalidArgumentException
- in vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php at line 91
- at FormRegistry ->getType ('text') in vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php at line 84
- at FormFactory ->createNamedBuilder ('flag', 'text', null, array()) in vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php at line 106
- at FormBuilder ->create ('flag', 'text', array()) in vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php at line 267
- at FormBuilder ->resolveChildren () in vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php at line 215
- at FormBuilder ->getForm () in src/MyProject/FrontOfficeBundle/Controller/ChallengeController.php at line 418
In the Controller I used this code:
$form = $this->createFormBuilder()
->add("flag","text")
->add("validate","button")
->getForm();
Even if I delete the first add("flag","text"), the error switch to:
Could not load type "button"
So I think that the problem is in the method getForm()
. I gassed that the method createFormBuilder()
need a parameter so I tried to pass an object Flag which it have many arguments (flag,validate,...).
The problem didn't change it's like the syntax was changed in this version but when I verified the documentation, I didn't found any problems in my syntax.
The form's version is 3.0-dev. I verified it in the github project and those files are the latests. I used
composer update
And I removed the cache and the logs files but problem exists.
Thanks for your help and sorry for my bad english.