I'd like to know if there's a way to set the value of an option in a select list. This select is a choice entity field.
Everything is working fine in my code. The point is that in my view I got the ID of each field in the value option and I need to have another field in there.
I'm using the option property to set what will be showed in the option name, but I need to set what will appear in the value field also.
I have no success to found a solution until now, so if anyone could help me out, it will be really appreciated.
A little part of my field in form type.
->add('fieldName','entity', array(
'class' => 'path\to\entity',
'property' => 'name',
'multiple' => true,
'expanded' => false,
)
Thanks.
My returned HTML code looks like this
<select>
<option value="4">ROLE_EXAMPLE</option>
</select>
What I'm trying to do is get a result like this:
<select>
<option value="specific_property_from_entity">ROLE_EXAMPLE</option>
</select>