contributte / contributte/datagrid
SQL filter
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 296
- Forks
- 215
- PR merge metrics
- No merged PRs in 30d
Description
In some situation I needed more complicated filter and hence the method in DibiFluentDataSource.php
`
/**
* Filter by keyword
* @param Filter\FilterText $filter
* @return void
*/
public function applyFilterText(Filter\FilterText $filter)
{
$condition = $filter->getCondition();
$driver = $this->data_source->getConnection()->getDriver();
$or = [];
foreach ($condition as $column => $value) {
if (class_exists(Dibi\Helpers::class) === TRUE) {
I modified for
/**
* Filter by keyword
* @param Filter\FilterText $filter
* @return void
*/
public function applyFilterText(Filter\FilterText $filter)
{
$condition = $filter->getCondition();
$driver = $this->data_source->getConnection()->getDriver();
$or = [];
foreach ($condition as $column => $value) {
if (substr($column, 0 ,4) == '%sql') {
$column = substr($column, 4);
} elseif (class_exists(Dibi\Helpers::class) === TRUE) {
`
Which allows in the function
addFilterText(column_name, text, [search_column_names])
parameters search_column_names in form '%sql.....' and sql expression that is verified against the text
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 in DibiFluentDataSource.php at applyFilterText() and inspect how Filter\FilterText conditions are processed. Trace the existing addFilterText(column_name, text, [search_column_names]) usage and the proposed %sql-prefixed expressions. Done means the SQL expressions are accepted and checked against the text without breaking the existing filter behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, sql
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100