tetranz / select2entity-bundle

A Symfony2 bundle that integrates Select2 as a drop-in replacement for a standard entity field on a Symfony form.
MIT License
219 stars 110 forks source link

Filter doesn´t found #175

Open detectivejd opened 3 years ago

detectivejd commented 3 years ago

Hi, how are you? I hope it´s ok. I need your help, the select2entity-bundle css and js work well, but the filter doesn´t else the load all the elements.

I put the code:

PaisRepository: public function findByFilter($dato){ $em = $this->getEntityManager(); $query = $em->createQuery("select p from App\Entity\Pais p where p.nombre like :nombre") ->setParameter('nombre', '%'.$dato.'%'); return $query->getResult(); }

PaisController: /**

DepartamentoType: public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('nombre',TextType::class,[ "label" => "Nombre (): ", "required" => "true", "empty_data" => '', "attr" => [ "class" =>"form-control" ] ]) ->add('pais', Select2EntityType::class,[ "label" => "País (): ", "remote_route" => 'pais_search', "class" => Pais::class, "allow_clear" => true, "placeholder" => "Seleccione País" ]) ; }

I took this picture:

Captura de pantalla de 2021-02-16 23-57-38

I don´t know as resolve the problem and i need your help. Greetings and thanks.

detectivejd commented 3 years ago

I´m using Symfony5 as php framework and try use select2entity-bundle but the filter doesn´t found it. What am i need to work with select2entity-bundle using Symfony5?

Please, I need some help.

Thanks.

juaniAla commented 3 years ago

Hi good day. Did you check that the filter reaches the repository? The values ​​in the DB are in uppercase and you search with lowercase. Maybe the solution will be out there