genemu/GenemuFormBundle — Issue #3: JQueryAutocompleterType should have no parent
Author: ibizaman
Created: 2011-10-21 16:29:51+00:00
State: open

Hi,

I opened an other issue because this time it's no more a feature request.

So the issue is regarding this code (on symfony2.0.4) :

```php
add('lieux', 'genemu_jqueryautocompleter', array(
'route_name' => 'lieu_request',
'multiple' => true,
));
```

*lieux* is a manyToMany association in my entity and *lieu_request* is a valid route.
This leads me to this error :

```
Expected argument of type "array", "Doctrine\Common\Collections\ArrayCollection" given
in vendor/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToChoicesTransformer.php at line 34
```

This means the ArrayToChoicesTransformer is called, and this is because the parent class of **JQueryAutocompleterType** is given by:

```php
public function getParent(array $options)
{
return $options['widget'];
}
```

and due to the default *$options['widget']* is *choice*, the parent is the *choice type*.
This is good if there is no ajax autoloading, but in this case I think it's not wanted.

Maybe it's again a mistake from my part ^^
Ibiz