I have for with drop down entity Customer by field name, my question how to change form for filter by name. Example in my drop down many customer, and I write "a" and in drop down remained only who have first letter in name "a"
$builder
->add('customer', 'entity', array(
'class' => Customer::class,
'attr' => array('class' => 'form-control select2 all_customers'),
'property' => 'name',
'empty_value' => 'Choice Customer',
'query_builder' => function ($repository) {
/** @var CustomerRepository $repository */
return $repository->getAllQuery();
},
'required' => false
))
this my template what need to do which create text field for filter
{{ form_start(form) }}
{{ form_errors(form) }}
{{ form_label(form.customer, label|default(null), {'label_attr': {'class': 'control-label'}}) }}
{{ form_widget(form.customer, {'attr': {'class': 'select2', 'type': 'text'}}) }}
{{ form_end(form) }}