mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 22:13:13 +00:00
revert exists filter and replacing by a generic one
This commit is contained in:
@@ -68,7 +68,7 @@ class User_Query implements User_QueryInterface
|
||||
protected $countries = null;
|
||||
protected $positions = null;
|
||||
protected $in_ids = null;
|
||||
protected $existsSql;
|
||||
protected $sqlFilters = [];
|
||||
protected $sql_params = null;
|
||||
|
||||
public function __construct(Application $app)
|
||||
@@ -101,9 +101,9 @@ class User_Query implements User_QueryInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function existsSql($sql)
|
||||
public function addSqlFilter($sql, array $params = [])
|
||||
{
|
||||
$this->existsSql = $sql;
|
||||
$this->sqlFilters[] = ['sql' => $sql, 'params' => $params];
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -888,8 +888,11 @@ class User_Query implements User_QueryInterface
|
||||
if ($this->in_ids) {
|
||||
$sql .= ' AND (Users.id = ' . implode(' OR Users.id = ', $this->in_ids) . ')';
|
||||
}
|
||||
if ($this->existsSql) {
|
||||
$sql .= sprintf(' AND EXISTS(%s)', $this->existsSql);
|
||||
if ($this->sqlFilters) {
|
||||
foreach ($this->sqlFilters as $sqlFilter) {
|
||||
$sql .= ' AND (' . $sqlFilter['sql'] . ')';
|
||||
$this->sql_params = array_merge($this->sql_params, $sqlFilter['params']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->have_rights) {
|
||||
|
Reference in New Issue
Block a user