How to pass a parameter to a symfony 5 form

I am trying to send parameter to a certain repository whether in the form or in the repository itself. I want to filter only product that belong to a certain warehouse. The curent user also belongs to the same warehouse.

below the form that have to show the product of the same warehouse with the current user
private $tokenStorageInterface;
public function __construct(TokenStorageInterface $tokenStorageInterface)
public function buildForm(FormBuilderInterface $builder, array $options)
// ->add(‘solde’)
->add(‘produitSite’, EntityType::class, [
‘class’ => ProduitSite::class,
‘query_builder’ => function (EntityRepository $er) {
return $er->findBySite( $tokenStorageInterface)
//->orderBy(‘p.produit.prix’, ‘ASC’)
// ->add(‘transfert’)


please help me , I tried in the repository or I dont if I have to send the filetered product from the controller to the form, Need your help


A complete template for 2022 focused on around React, Postgres and various web3 integrations

Use regular expressions to detect date format