genemu / GenemuFormBundle

Extra Form : Captcha GD, Tinymce, Recaptcha, JQueryDate, JQueryAutocomplete, JQuerySlider, JQueryFile, JQueryImage
587 stars 265 forks source link

SF2.8.8 and getBlockPrefix() bug #432

Closed retosteffen closed 7 years ago

retosteffen commented 7 years ago

Since getName() was replaced with getBlockPrefix() I get this error The type name specified for the service "genemu.form.jquery.type.select2.entity" does not match the actual name. Expected "genemu_jqueryselect2_entity", given "Genemu\Bundle\FormBundle\Form\JQuery\Type\Select2Type"

Having both getBlockPrefix() and getName() public function getName() { return $this->getBlockPrefix(); } aka compatibility for SF<2.8 fixes the problem.

430

pull request Any one else getting the same problem?

bamarni commented 7 years ago

Thanks for reporting, I've added this method back.

retosteffen commented 7 years ago

Thanks! I'm wondering if it's because I'm still using the "old" way of building forms with

$builder->add('genres', 'genemu_jqueryselect2_entity', array('required'=>false,
            'class' => Genre',
            'choice_label' => 'name',
            'multiple'=>'multiple'
        ));

and not the new way with

use XXX
$builder->add('genres', XXX::class,...)
bamarni commented 7 years ago

Currently it's not possible to use the new way as there is one class for multiple widgets. I'll deprecate this type and remove it in the next major version, I suggest you to use a css class to enable select2.