Fix User\Filter
This commit is contained in:
parent
827037d0be
commit
8d17d76061
1 changed files with 12 additions and 6 deletions
|
@ -23,7 +23,7 @@ class Filter extends Action
|
|||
{
|
||||
$fields = $this->c->dbMap->users;
|
||||
$orderBy = [];
|
||||
$where = ['u.id>1'];
|
||||
$where = [];
|
||||
|
||||
foreach ($order as $field => $dir) {
|
||||
if (! isset($fields[$field])) {
|
||||
|
@ -98,11 +98,17 @@ class Filter extends Action
|
|||
}
|
||||
}
|
||||
|
||||
$where = \implode(' AND ', $where);
|
||||
$query = "SELECT u.id
|
||||
FROM ::users AS u
|
||||
WHERE {$where}
|
||||
ORDER BY {$orderBy}";
|
||||
if (empty($where)) {
|
||||
$query = "SELECT u.id
|
||||
FROM ::users AS u
|
||||
ORDER BY {$orderBy}";
|
||||
} else {
|
||||
$where = \implode(' AND ', $where);
|
||||
$query = "SELECT u.id
|
||||
FROM ::users AS u
|
||||
WHERE {$where}
|
||||
ORDER BY {$orderBy}";
|
||||
}
|
||||
|
||||
return $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue