-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #5823 Allow searching by associated fields with the same name (Lu…
…stmored) This PR was squashed before being merged into the 4.x branch. Discussion ---------- Allow searching by associated fields with the same name This little change handles the case when we have custom search fields defined in CRUD configuration, but each pointing to a field with the same name. Example taken from my daily project: Entity `Department` has (among others) 2 associations - `City` and `Company`. In CRUD I'd like to easily search by department name and both company name and city name, so: `->setSearchFields(['id', 'name', 'city.name', 'company.name'])` The way it's done in `EntityRepository` makes it only search by `company.name`, as field name is taken as the key for search fields configuration. I moved the field name to a property and return a list from `getSearchablePropertiesConfig()` to mitigate the issue. This time around I was able to work with tests - I have extended `BlogPost` fixture to include optional publisher association and then search by both `author` and `publisher`. It fails without this little change and works as expected after. Commits ------- 903abf1 Allow searching by associated fields with the same name
- Loading branch information
Showing
5 changed files
with
33 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters