Symfony2 - How to validate autocomplete entity form type? Symfony2 - How to validate autocomplete entity form type? symfony symfony

Symfony2 - How to validate autocomplete entity form type?


Instead of using entity field type, use simple text type that will accept ID of the associated entity. You also need to make data transformer to transform submitted ID to entity object (and vice versa) that will be set on the form's data entity.

Data transformer example

Validation will work as if it was entity field type, thanks to the data transformer.