EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

setSearchFields not working for two related entities with the same field names

Open kadiiski opened this issue 3 years ago • 2 comments

Describe the bug In configureCrud if two related entities are set in setSearchFields with the same property names - only one is searched because of wrong prop names mapping in EasyCorp\Bundle\EasyAdminBundle\Orm\EntityRepository

...->setSearchFields(['id', 'unit.name', 'client.name']) would only search in client.name and not in unit.name.

To Reproduce

  1. create 3 entities.
  2. link two of them to the third one
  3. add "name" (or other) prop to the linked entities (should be the same name prop)
  4. add ...->setSearchFields(['first_entity.name', 'second_entity.name']) to the crud CrudController of the entity that has the relations for both
  5. go to the admin listing for the entity and try searching for one of the other entity
  6. only the results for the name of the second one will be highlighted/found

Additional context

  • easycorp/easyadmin-bundle: 4.7.0
  • php: 8.0.2
  • symfony: 6.2

kadiiski avatar Aug 02 '23 11:08 kadiiski

Already fixed in #5823

chapterjason avatar Aug 02 '23 19:08 chapterjason

Closing as fixed. Thanks.

javiereguiluz avatar Dec 31 '24 12:12 javiereguiluz