Parcourir la source

Less magic

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v21.0.0beta1
Joas Schilling il y a 3 ans
Parent
révision
6400221fba
Aucun compte lié à l'adresse e-mail de l'auteur
1 fichiers modifiés avec 12 ajouts et 4 suppressions
  1. 12
    4
      lib/private/Comments/Manager.php

+ 12
- 4
lib/private/Comments/Manager.php Voir le fichier

@@ -435,7 +435,11 @@ class Manager implements ICommentsManager {
if ($lastKnownComment instanceof IComment) {
$lastKnownCommentDateTime = $lastKnownComment->getCreationDateTime();
if ($sortDirection === 'desc') {
$idComparison = $includeLastKnown ? 'lte' : 'lt';
if ($includeLastKnown) {
$idComparison = $query->expr()->lte('id', $query->createNamedParameter($lastKnownCommentId));
} else {
$idComparison = $query->expr()->lt('id', $query->createNamedParameter($lastKnownCommentId));
}
$query->andWhere(
$query->expr()->orX(
$query->expr()->lt(
@@ -449,12 +453,16 @@ class Manager implements ICommentsManager {
$query->createNamedParameter($lastKnownCommentDateTime, IQueryBuilder::PARAM_DATE),
IQueryBuilder::PARAM_DATE
),
$query->expr()->$idComparison('id', $query->createNamedParameter($lastKnownCommentId))
$idComparison
)
)
);
} else {
$idComparison = $includeLastKnown ? 'gte' : 'gt';
if ($includeLastKnown) {
$idComparison = $query->expr()->gte('id', $query->createNamedParameter($lastKnownCommentId));
} else {
$idComparison = $query->expr()->gt('id', $query->createNamedParameter($lastKnownCommentId));
}
$query->andWhere(
$query->expr()->orX(
$query->expr()->gt(
@@ -468,7 +476,7 @@ class Manager implements ICommentsManager {
$query->createNamedParameter($lastKnownCommentDateTime, IQueryBuilder::PARAM_DATE),
IQueryBuilder::PARAM_DATE
),
$query->expr()->$idComparison('id', $query->createNamedParameter($lastKnownCommentId))
$idComparison
)
)
);

Chargement…
Annuler
Enregistrer