mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 06:23:18 +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 $countries = null;
|
||||||
protected $positions = null;
|
protected $positions = null;
|
||||||
protected $in_ids = null;
|
protected $in_ids = null;
|
||||||
protected $existsSql;
|
protected $sqlFilters = [];
|
||||||
protected $sql_params = null;
|
protected $sql_params = null;
|
||||||
|
|
||||||
public function __construct(Application $app)
|
public function __construct(Application $app)
|
||||||
@@ -101,9 +101,9 @@ class User_Query implements User_QueryInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function existsSql($sql)
|
public function addSqlFilter($sql, array $params = [])
|
||||||
{
|
{
|
||||||
$this->existsSql = $sql;
|
$this->sqlFilters[] = ['sql' => $sql, 'params' => $params];
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -888,8 +888,11 @@ class User_Query implements User_QueryInterface
|
|||||||
if ($this->in_ids) {
|
if ($this->in_ids) {
|
||||||
$sql .= ' AND (Users.id = ' . implode(' OR Users.id = ', $this->in_ids) . ')';
|
$sql .= ' AND (Users.id = ' . implode(' OR Users.id = ', $this->in_ids) . ')';
|
||||||
}
|
}
|
||||||
if ($this->existsSql) {
|
if ($this->sqlFilters) {
|
||||||
$sql .= sprintf(' AND EXISTS(%s)', $this->existsSql);
|
foreach ($this->sqlFilters as $sqlFilter) {
|
||||||
|
$sql .= ' AND (' . $sqlFilter['sql'] . ')';
|
||||||
|
$this->sql_params = array_merge($this->sql_params, $sqlFilter['params']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->have_rights) {
|
if ($this->have_rights) {
|
||||||
|
Reference in New Issue
Block a user