Could not load type "Symfony\Component\Form\Extension\Core\Type\HiddenType"
In Symfony 2.7.10/2.7.9 the latest update breaks, with any form type using hidden_entity:
Could not load type "Symfony\Component\Form\Extension\Core\Type\HiddenType"
This commit here: https://github.com/LRotherfield/Form/commit/b9cf8349cf9f45545af2f7f1c16a33efe23d2a71
/**
* Set the parent form type to Symfony core HiddenType
*
* TODO: when drop Symfony 2.x support, add use statement above
* for HiddenType core class and return HiddenType::class
* here instead of path string
*
* @return string
*/
public function getParent()
{
return 'hidden';
}
I just change getParent to return 'hidden' instead of the class name and it works again. Not sure what else to do to help... but just a heads up.
Thanks for the report, I will see if I can sort this.
I can confirm this error in Symfony 2.6 too.
Fast workaround:
- create class extending
Lrotherfield\Component\Form\Type\HiddenEntityTypeand add inside
public function getParent()
{
return 'hidden';
}
- replace class in services.yml for
lrotherfield.form.type.hidden_entityfor this created in 1)
Works for now, but it should be configurable somehow
The fix is to revert to version 1.1.2.
But since versions 1.1.1 and 1.1.2 are invalid, and so are not propagating to packagist, you cannot use a version identifier in composer.
Instead:
"lrotherfield/form" : "dev-master#799597f",
Also the next version should be a major one (either 1.2 or 2.0), so that it's clear that it breaks compatibility with Symfony versions <= 2.7.
@djcvijic I have pushed a tag v2.0.0 as a release for symfony3 support and hopefully fixed the composer issues to allow downloads of v1.1.2 (which should probably have been 1.1.3)
@djcvijic can you confirm that updating the commit for tag 1.1.2 is likely to break installations for people using composer install from current composer.lock files? Will they need delete the source and run composer update to get the latest version?
Since 1.1.2 was not propagating to packagist anyway, moving the tag has not broken anything. And since those of us using the legacy revision need to change our composer config from "lrotherfield/form" : "dev-master#799597f", to "lrotherfield/form" : "1.1.2",, we're expected to run a composer update anyway for the change to take effect, so I think everyone will be fine with that.
Thanks again!