framework
framework copied to clipboard
[DataGrid] Make Filter more flexible by configuring used JOIN
Description
In case when you need using default search filter in DataGrid by nullable field I've detected that Filter uses INNER JOIN on building Select Query.
If values are nullable this moment reduces amount of records and it is not fully suitable in cases when I want to make search by some optional fields.
It will be great if Filter was more flexible and allows to define used JOIN type.
How To Reproduce
Make any simple table with nullable field. For example it can be updatedBy. This field will be changed only after update.
Insert some records with different values in this field.
Configure your Grid with using filter search by updatedBy.email like this:
$this->addFilter(
'search',
new Filter\Any(
new Filter\Like('name'),
new Filter\Like('updatedBy.email')
)
);
Prepare grid and use search by default grid search.
Check prepared sql by logs
Additional Info
| Q | A |
|---|---|
| Framework Version | 2.7.8 |
| PHP version | 7.4.16 |