Skip to content

Commit

Permalink
[skip ci] [REST] fix filter with arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheron committed Mar 7, 2021
1 parent 9ded322 commit 684c0dd
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ trait RestControllerUtilitiesTrait {
abstract public function _setResponseCode($value);

protected function getDatas() {
return $this->_getRequestFormatter()->getDatas($this->model);
return $this->_getRequestFormatter ()->getDatas ( $this->model );
}

/**
Expand All @@ -42,7 +42,7 @@ protected function getDatas() {
* @return string|boolean
*/
protected function getRequestParam($param, $default) {
return $_GET[$param]??$default;
return $_GET [$param] ?? $default;
}

protected function operate_($instance, $callback, $status, $exceptionMessage, $keyValues) {
Expand Down Expand Up @@ -274,7 +274,15 @@ protected function getPrimaryKeysFromDatas($datas, $model) {
}

protected function getCondition($condition) {
$condition = urldecode ( $condition );
if (\is_array ( $condition )) {
$conds = [ ];
foreach ( $condition as $f => $v ) {
$conds [] = $f . "='" . \urldecode ( $v ) . "'";
}
$condition = \implode ( ' AND ', $conds );
} else {
$condition = \urldecode ( $condition );
}
if (\strpos ( $condition, 'like' ) !== false) {
$condition = \str_replace ( '*', '%', $condition );
}
Expand Down

0 comments on commit 684c0dd

Please sign in to comment.