I have this Symfony form with a ManyToMany relation working fine, it displays all the parties with the property name on the entity Party.
When submitted, it queries the database according to the parties that are selected and retrieves the persons that are invited to those parties.
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('parties', 'entity', array(
'class' => 'ProtoBundle:Party',
'multiple' => true,
'expanded' => false,
'property' => 'name',
'required' => false,));
}
with the parameter
'multiple' => 'true,
all the parties are displayed at the same time in a select drop down box (not what i want).
What I want is just to have one select tag with parameter
'empty_value' => 'choose a party'
, then when the user clicks on it, the values are displayed. Actually I can do this with the parameter
'multiple'=> false,
but the problem is that I get this error message:
Neither the property "parties" nor one of the methods "setParties()", "__set()" or "__call()" exist and have public access in class "Acme\ProtoBundle\Entity\Person".
Does anyone knows how to make this select tag working and bring me a detailed solution?