tetranz / select2entity-bundle – CollectionType and req_params

I’ve created a form (with Symfony 5) with a CollectionType:

$builder
            ->add('movieBiographies', CollectionType::class, array('label' => false, 'entry_type' => MovieBiographyAdminType::class, "allow_add" => true, "allow_delete" => true, "entry_options" => ["language" => $language]));

Inside my CollectionType, there is a Select2 field:

    $builder
        ->add('biography', Select2EntityType::class, [
            'multiple' => false,
            'remote_route' => 'Biography_Admin_Autocomplete',
            'class' => Biography::class,
            'page_limit' => 10,
            'primary_key' => 'id',
            'text_property' => 'title',
            'allow_clear' => true,
            'delay' => 250,
            'cache' => false,
            'cache_timeout' => 60000,
            'req_params' => ['locale' => 'parent.children[language]']
        ])
    ;

Now, I want that "biography" field depends of the field "language" of my main form. I have already tried several things but nothing worked.

Is there a solution? I looked in the bundle documentation and couldn’t find anything.

Thanks for your help.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *