Symfony 4 get repository in template batch action

I use Symfony 4 and sonata admin.
I created a custom batch action in the member list. I would like to have access to the other repositories in the batch action template. I would like to be able to select products before sending it to the members.

How to pass the repository by batch action?

    $actions['sendProducts'] = [
        'label' => 'Envoyer les produits',
        'ask_confirmation' => true,
        'template' => 'send-products.html.twig'

In my template I would like to have a select with all the names of my products (created in my products entity).


Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

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