mercredi 25 février 2015

Change symfony2 form field but keep relation

So I have a form that is based on an entity that contains a one to many relationship.


The problem is that this field is rendered as a select (or choice). I really don't want to load all the possible ids (there are many) but just want to load the one that is set in the entity (which is the id that appears selected in the select).


Is there any way of doing this and still keep the relationship? If I really have to change the field how can I access, in the form class, the selected entity given to the entity so that I can retrieve the id?


Aucun commentaire:

Enregistrer un commentaire