Open scottshipman opened 8 years ago
same here, using genemu/form-bundle v2.2.2 with symfony v2.7.3
Yes, I have the same issue. It's because Choice form has been completely refactored in Symfony 2.7 http://symfony.com/blog/new-in-symfony-2-7-choice-form-type-refactorization
In class, Genemu\Bundle\FormBundle\Form\Core\DataTransformer, now, $choiceList is an instance of LegacyChoiceListAdapter
this is a beginning of fix:
use Symfony\Component\Form\ChoiceList\LegacyChoiceListAdapter;
/**
* Constructs
*
* @param ArrayChoiceList $choiceList
* @param boolean $ajax
*/
public function __construct($choiceList, $ajax = false, $widget = 'choice', $multiple = false)
{
if ($choiceList instanceof LegacyChoiceListAdapter){
$this->choiceList = $choiceList->getAdaptedList();
}
else if($choiceList instanceof ChoiceListInterface){
$this->choiceList = $choiceList;
}
$this->ajax = $ajax;
$this->multiple = $multiple;
$this->widget = $widget;
}
I took exemple on Sonata Admin bundle (Sonata\AdminBundle\Form\DataTransformer). But I have now another error. Notice: Undefined offset: 1 on file in vendor/symfony/symfony/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php at line 213
regards,
Please, if anyone find out how to solve this, let us know. I'm having the same problem with this bundle with Symfony 2.7.7.
Regards.
Should be closed @genemu in favor of https://github.com/genemu/GenemuFormBundle/issues/412
Current workaround by @aimeric: https://github.com/genemu/GenemuFormBundle/issues/412#issuecomment-169946398
I get the following error when I implement genemu_jqueryautocompleter_entity, but no errors when I implement genemu_jqueryautocomplete_entity. The salesAgent and secondaryContact fields are identical definitions, and swapping fields makes no difference.
Catchable Fatal Error: Argument 1 passed to Genemu\Bundle\FormBundle\Form\Core\DataTransformer\ChoiceToJsonTransformer::__construct() must implement interface Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface, instance of Symfony\Component\Form\ChoiceList\LegacyChoiceListAdapter given, called in /srv/www/Toolkit/vendor/genemu/form-bundle/Genemu/Bundle/FormBundle/Form/JQuery/Type/AutocompleterType.php on line 46 and defined
using symfony v 2.7 genemu/form-bundle dev-master (2.3.x-dev)