I have a problem, I want to filter the output data in this entity type I found a solution but I should change the value of searchterm inside the script,
$searchTerm = 'ri'; $builder->add('userInput', EntityType::class, [ 'class' => User::class, 'query_builder' => function(EntityRepository $er) use ($searchTerm) { return $er->createQueryBuilder('u') ->where('u.username LIKE :searchTerm') ->setParameter('searchTerm', '%'.$searchTerm.'%') ->orderBy('u.username', 'ASC'); }, 'choice_label' => 'username', 'required' => false, ])
I want to add bar search to this entityType to filter the data of u.username