Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid duplicate queries that were caused by running execute and the mapper find method #2804

Merged
merged 1 commit into from Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/Db/SessionMapper.php
Expand Up @@ -64,8 +64,7 @@ public function findAll($documentId) {
$qb = $this->db->getQueryBuilder();
$qb->select('id', 'color', 'document_id', 'last_contact', 'user_id', 'guest_name')
->from($this->getTableName())
->where($qb->expr()->eq('document_id', $qb->createNamedParameter($documentId)))
->execute();
->where($qb->expr()->eq('document_id', $qb->createNamedParameter($documentId)));

return $this->findEntities($qb);
}
Expand All @@ -75,8 +74,7 @@ public function findAllActive($documentId) {
$qb->select('id', 'color', 'document_id', 'last_contact', 'user_id', 'guest_name')
->from($this->getTableName())
->where($qb->expr()->eq('document_id', $qb->createNamedParameter($documentId)))
->andWhere($qb->expr()->gt('last_contact', $qb->createNamedParameter(time() - SessionService::SESSION_VALID_TIME)))
->execute();
->andWhere($qb->expr()->gt('last_contact', $qb->createNamedParameter(time() - SessionService::SESSION_VALID_TIME)));

return $this->findEntities($qb);
}
Expand All @@ -85,8 +83,7 @@ public function findAllInactive() {
$qb = $this->db->getQueryBuilder();
$qb->select('id', 'color', 'document_id', 'last_contact', 'user_id', 'guest_name')
->from($this->getTableName())
->where($qb->expr()->lt('last_contact', $qb->createNamedParameter(time() - SessionService::SESSION_VALID_TIME)))
->execute();
->where($qb->expr()->lt('last_contact', $qb->createNamedParameter(time() - SessionService::SESSION_VALID_TIME)));

return $this->findEntities($qb);
}
Expand Down
3 changes: 1 addition & 2 deletions lib/Db/StepMapper.php
Expand Up @@ -46,8 +46,7 @@ public function find($documentId, $fromVersion, $lastAckedVersion = null) {
$qb
->setMaxResults(100)
->orderBy('version')
->orderBy('id')
->execute();
->orderBy('id');

return $this->findEntities($qb);
}
Expand Down