EasyAdminBundle
EasyAdminBundle copied to clipboard
setSearchFields not working for two related entities with the same field names
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
- create 3 entities.
- link two of them to the third one
- add "name" (or other) prop to the linked entities (should be the same name prop)
- add
...->setSearchFields(['first_entity.name', 'second_entity.name'])to the crud CrudController of the entity that has the relations for both - go to the admin listing for the entity and try searching for one of the other entity
- only the results for the
nameof the second one will be highlighted/found
Additional context
- easycorp/easyadmin-bundle: 4.7.0
- php: 8.0.2
- symfony: 6.2
Already fixed in #5823
Closing as fixed. Thanks.