->add('billManagement', 'sonata_type_choice_field_mask', array(
'choices' => array(
'FI' => 'FI',
'GI' => 'GI'
),
'map' => array(
'FI' => array('company'),
'GI' => array('company')
),
'empty_value' => 'Mode de financement',
'required' => true
))
->add('company')
->end()
I show here a list box with choices such as "GI" or "FI". Depending on the choice, another box list is displayed. A box Companies list. But always depending on the choice, the list of companies to be filtered. I would like to see a company whose query field changes depending on the choice of billManagement, "FI" or "GI".
I tried that but it does not work
->add('billManagement', 'sonata_type_choice_field_mask', array(
'choices' => array(
'FI' => 'FI',
'GI' => 'GI'
),
'map' => array(
'FI' => $formMapper->add('company', 'sonata_type_model', array(
'class' => 'AppBundle\Entity\User\Company',
'query' => $companyFinance
)),
'GI' => $formMapper->add('company', 'sonata_type_model', array(
'class' => 'AppBundle\Entity\User\Company',
'query' => $company
)),
),
'empty_value' => 'Mode de financement',
'required' => true
))
->end()