How to implement choose user type in Symfony2 Forms?
I want to create in form filed called user. And be able to choose user from DB (via Doctrine) with autocomplete.
1)You have to add in your form builder :
2)Use the javascript library you want (i.e bootstrap typeahead is a good one).
3)Then, the javascript trigger an ajax method pointing on a action on your controller. This action return a list of user type (most likely encoded in json format)
4) Once the form is submited, in the update/create action of yours, find the entity corresponding to the hidden id submited, and link it to the entity