Created
June 14, 2017 20:23
-
-
Save rileyrg/92e9598ec875c244f131d152935f0549 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | |
if (empty($values['value'])) { | |
return null; | |
} | |
$paramName = sprintf('p_%s', str_replace('.', '_', $field)); | |
// expression that represent the condition | |
$expression = $filterQuery->getExpr()->eq($field, ':' . $paramName); | |
// expression parameters | |
$parameters = array($paramName => $values['value']); // [ name => value ] | |
// or if you need to define the parameter's type | |
// $parameters = array($paramName => array($values['value'], \PDO::PARAM_STR)); // [ name => [value, type] ] | |
return $filterQuery->createCondition($expression, $parameters); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment