mirror of
https://github.com/jbcr/core.git
synced 2026-04-28 19:23:14 +02:00
Use setcontent to filter with checkbox true or false
This commit is contained in:
committed by
Bob den Otter
parent
1aa117d43a
commit
772a3f1c8a
@@ -20,7 +20,7 @@ class JsonHelper
|
||||
*
|
||||
* @return string|array
|
||||
*/
|
||||
public static function wrapJsonFunction(?string $where = null, ?string $slug = null, Connection $connection)
|
||||
public static function wrapJsonFunction(?string $where = null, $slug = null, Connection $connection)
|
||||
{
|
||||
$version = new Version($connection);
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ class QueryParameterParser
|
||||
/**
|
||||
* The default handler is the last to be run and handles simple value parsing.
|
||||
*
|
||||
* @param string|array $value
|
||||
* @param string|array|bool $value
|
||||
*/
|
||||
public function defaultFilterHandler(string $key, $value, Expr $expr): Filter
|
||||
{
|
||||
@@ -272,6 +272,12 @@ class QueryParameterParser
|
||||
}
|
||||
|
||||
$val = $this->parseValue((string) $value);
|
||||
|
||||
// @todo: Can this be refactored to avoid ugly override when $value is bool?
|
||||
if (is_bool($value)) {
|
||||
$val['value'] = $value;
|
||||
}
|
||||
|
||||
$placeholder = $key . '_1';
|
||||
$exprMethod = $val['operator'];
|
||||
|
||||
|
||||
@@ -178,12 +178,16 @@ class SelectQuery implements QueryInterface
|
||||
{
|
||||
// Change all params to lowercase, filter out empty ones
|
||||
$this->params = array_filter(
|
||||
Arr::mapRecursive($params, function ($a) {
|
||||
return mb_strtolower((string) $a, 'utf-8');
|
||||
Arr::mapRecursive($params, function ($param) {
|
||||
if (is_bool($param)) {
|
||||
return $param;
|
||||
}
|
||||
|
||||
return mb_strtolower((string) $param, 'utf-8');
|
||||
}
|
||||
), function ($a) {
|
||||
), function ($param) {
|
||||
// ignore parameter if like statement is empty
|
||||
return $a !== '%%';
|
||||
return $param !== '%%';
|
||||
});
|
||||
|
||||
$this->processFilters();
|
||||
|
||||
Reference in New Issue
Block a user