genemu / GenemuFormBundle

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

autocomplete_entity: cannot handle mapped fields #335

Open sctt opened 10 years ago

sctt commented 10 years ago

hi,

im using symfony 2.4 and my "Company" form includes an autocomplete field to map a CompanyGroup:

        ->add('company_group', 'genemu_jqueryautocomplete_entity', array(
            'class'           => '\MyBundle\Entity\CompanyGroup',
            'property'        => 'name',
            'mapped'          => true, ))

the problem is that if mapped option is set to true, i get this error:

The form's view data is expected to be of type scalar, array or an instance of \ArrayAccess, but is an instance of class ProxiesCG\MyBundle\Entity\CompanyGroup. You can avoid this error by setting the "data_class" option to "ProxiesCG\MyBundle\Entity\CompanyGroup" or by adding a view transformer that transforms an instance of class ProxiesCG\MyBundle\Entity\CompanyGroup to scalar, array or an instance of \ArrayAccess.

if mapped option is set to false i have to implement everything "by hand", and i'd like to let symfony do his job.

do you know what im doing wrong? could it be related to symfony 2.4 version?

thank you.