perf: Don't call twice the same query
Find entities will execute the query already, there is no need to do it twice. Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
This commit is contained in:
@@ -45,8 +45,7 @@ class SessionMapper extends QBMapper {
|
|||||||
$qb->select('id', 'board_id', 'last_contact', 'user_id', 'token')
|
$qb->select('id', 'board_id', 'last_contact', 'user_id', 'token')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
->where($qb->expr()->eq('board_id', $qb->createNamedParameter($boardId)))
|
->where($qb->expr()->eq('board_id', $qb->createNamedParameter($boardId)))
|
||||||
->andWhere($qb->expr()->gt('last_contact', $qb->createNamedParameter(time() - SessionService::SESSION_VALID_TIME)))
|
->andWhere($qb->expr()->gt('last_contact', $qb->createNamedParameter(time() - SessionService::SESSION_VALID_TIME)));
|
||||||
->executeQuery();
|
|
||||||
|
|
||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user