EasyCorp / EasyCorp/EasyAdminBundle
CRUD Controller feature request: $crud->addSearchField()
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.3k
- Forks
- 1.1k
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 11
Description
Short description of what this feature will allow to do:
In the AbstractCrudController::configureCrud method, there is a way to pass a set of searchable fields via setSearchFields():
public function configureCrud(Crud $crud): Crud
{
return $crud
...
->setSearchFields(['name', 'description', 'seller.email', 'seller.address.zipCode'])
...
https://symfony.com/bundles/EasyAdminBundle/current/crud.html#search-order-and-pagination-options
However, if you have an association, you would need to explicitly declare all of the searchable fields, which could be quite a few:
// Manually include default search fields, and an association property field
$crud->setSearchFields(['name','description',...,...,'association_field.property'];
Example of how to use this feature
It would be nice to be able to simply tack on the association field rather than copy paste all the other fields and then add the other field, something like:
// Include all the default property fields, and the additional association property:
$crud->addSearchField('association_field.property');
and / or
$crud->addSearchFields(['association_field.property']);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at AbstractCrudController::configureCrud and trace the existing setSearchFields() behavior, including how default searchable property fields are determined. Check the CRUD configuration and related tests before defining the addSearchField() and addSearchFields() API. Done means an association property can be added without manually copying the default search fields, with coverage for the requested examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, symfony
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100