Skip to content

Commit

Permalink
FilterProcessor change to support queries with 'Like Operator'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ibrar Azeem committed Apr 8, 2016
1 parent 352206c commit bd37d4e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Processor/FilterProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ public function process($src, OperationInterface $operation)
$value = $operation->getValue();
$operator = $operation->getOperator();
$field = $operation->getField();
if($operator == FilterOperation::STR_STARTS_WITH){
$operator = FilterOperation::OPERATOR_LIKE;
$value = $value."%";
}else if($operator == FilterOperation::STR_ENDS_WITH){
$operator = FilterOperation::OPERATOR_LIKE;
$value = "%".$value;
}else if($operator == FilterOperation::STR_CONTAINS){
$operator = FilterOperation::OPERATOR_LIKE;
$value = "%".$value."%";
}
$src->where($field, $operator, $value);
return $src;
}
Expand Down

0 comments on commit bd37d4e

Please sign in to comment.