Skip to content

Commit

Permalink
Merge pull request #2 from abrarazeem/master
Browse files Browse the repository at this point in the history
FilterProcessor change to support queries with 'Like' operator
  • Loading branch information
Nayjest committed Apr 8, 2016
2 parents 352206c + bd37d4e commit c4984fb
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 c4984fb

Please sign in to comment.