Diocese:
id | diocese_name |
---|---|
1 | DJ |
2 | Kpg |
OneToMany
Parish:
id | diocese_id | parish_name |
---|---|---|
1 | 1 | St. Jude |
2 | 1 | St. Mark |
3 | 2 | St. Peter |
4 | 2 | St. thomas |
I want to make a drop down dynamic:when the user clicks on Diocese name, It should Display the related Parish Name.
I tried with Form Event, but I couldn't follow the documentation.Here is the Code.
$builder->add('diocese_name', EntityType::class,['class' => 'App\Entity\Diocese','choice_label' => 'diocese_name']);$builder->addEventListener( FormEvents::PRE_SET_DATA, function(FormEvent $event){ $form = $event->getForm(); $data = $event->getData(); $parish = $data->getParish(); dump($parish); });