Skip to content

Commit

Permalink
Merge pull request #90 from asaf050/master
Browse files Browse the repository at this point in the history
Fix URL pagination issue
  • Loading branch information
Nayjest committed Nov 23, 2015
2 parents 19ae11f + 621686c commit c0eb709
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 6 deletions.
23 changes: 23 additions & 0 deletions src/DbalDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,29 @@ public function orderBy($fieldName, $direction)

public function filter($fieldName, $operator, $value)
{
switch ($operator) {
case "eq":
$operator = '=';
break;
case "n_eq":
$operator = '<>';
break;
case "gt":
$operator = '>';
break;
case "lt":
$operator = '<';
break;
case "ls_e":
$operator = '<=';
break;
case "gt_e":
$operator = '>=';
break;
default:
$operator = 'like';
break;
}
$this->src->andWhere("$fieldName $operator :$fieldName");
$this->src->setParameter($fieldName, $value);
return $this;
Expand Down
23 changes: 23 additions & 0 deletions src/EloquentDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,29 @@ public function orderBy($fieldName, $direction)
*/
public function filter($fieldName, $operator, $value)
{
switch ($operator) {
case "eq":
$operator = '=';
break;
case "n_eq":
$operator = '<>';
break;
case "gt":
$operator = '>';
break;
case "lt":
$operator = '<';
break;
case "ls_e":
$operator = '<=';
break;
case "gt_e":
$operator = '>=';
break;
default:
$operator = 'like';
break;
}
$this->src->where($fieldName, $operator, $value);
return $this;
}
Expand Down
12 changes: 6 additions & 6 deletions src/FilterConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
class FilterConfig
{
const OPERATOR_LIKE = 'like';
const OPERATOR_EQ = '=';
const OPERATOR_NOT_EQ = '<>';
const OPERATOR_GT = '>';
const OPERATOR_LS = '<';
const OPERATOR_LSE = '<=';
const OPERATOR_GTE = '>=';
const OPERATOR_EQ = 'eq';
const OPERATOR_NOT_EQ = 'n_eq';
const OPERATOR_GT = 'gt';
const OPERATOR_LS = 'lt';
const OPERATOR_LSE = 'ls_e';
const OPERATOR_GTE = 'gt_e';


/** @var FieldConfig */
Expand Down

0 comments on commit c0eb709

Please sign in to comment.