mirror of https://github.com/nextcloud/server
Merge pull request #36261 from nextcloud/techdebt/noid/warn-devs-about-potential-bugs
fix(querybuilder): Log a warning if where() is called again on a quer…
This commit is contained in:
commit
ecad09b38a
|
@ -864,6 +864,12 @@ class QueryBuilder implements IQueryBuilder {
|
|||
* @return $this This QueryBuilder instance.
|
||||
*/
|
||||
public function where(...$predicates) {
|
||||
if ($this->getQueryPart('where') !== null && $this->systemConfig->getValue('debug', false)) {
|
||||
// Only logging a warning, not throwing for now.
|
||||
$e = new QueryException('Using where() on non-empty WHERE part, please verify it is intentional to not call whereAnd() or whereOr() instead. Otherwise consider creating a new query builder object or call resetQueryPart(\'where\') first.');
|
||||
$this->logger->warning($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
|
||||
call_user_func_array(
|
||||
[$this->queryBuilder, 'where'],
|
||||
$predicates
|
||||
|
|
Loading…
Reference in New Issue