aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Comments
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-05-23 13:02:36 +0200
committerJoas Schilling <coding@schilljs.com>2022-05-23 13:02:36 +0200
commit5b82ad0b306034e299e965f5f43542e071b29c0f (patch)
treeb64538c2502a89f5e63b46064743334064a4232a /lib/private/Comments
parent8d599c341023c5fe850da9bdbc3807a277a61151 (diff)
downloadnextcloud-server-5b82ad0b306034e299e965f5f43542e071b29c0f.tar.gz
nextcloud-server-5b82ad0b306034e299e965f5f43542e071b29c0f.zip
Create query parameters on correct objects to make debugging easier
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Comments')
-rw-r--r--lib/private/Comments/Manager.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 4a06ac62f1e..b7532222c33 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -1258,8 +1258,6 @@ class Manager implements ICommentsManager {
}
private function sumReactions(string $parentId): void {
- $qb = $this->dbConn->getQueryBuilder();
-
$totalQuery = $this->dbConn->getQueryBuilder();
$totalQuery
->selectAlias(
@@ -1273,7 +1271,7 @@ class Manager implements ICommentsManager {
)
->selectAlias($totalQuery->func()->count('id'), 'total')
->from('reactions', 'r')
- ->where($totalQuery->expr()->eq('r.parent_id', $qb->createNamedParameter($parentId)))
+ ->where($totalQuery->expr()->eq('r.parent_id', $totalQuery->createNamedParameter($parentId)))
->groupBy('r.reaction')
->orderBy('total', 'DESC')
->addOrderBy('r.reaction', 'ASC')
@@ -1291,9 +1289,10 @@ class Manager implements ICommentsManager {
)
->from($jsonQuery->createFunction('(' . $totalQuery->getSQL() . ')'), 'json');
+ $qb = $this->dbConn->getQueryBuilder();
$qb
->update('comments')
- ->set('reactions', $jsonQuery->createFunction('(' . $jsonQuery->getSQL() . ')'))
+ ->set('reactions', $qb->createFunction('(' . $jsonQuery->getSQL() . ')'))
->where($qb->expr()->eq('id', $qb->createNamedParameter($parentId)))
->executeStatement();
}