class EntryRepository extends EntityRepository
{
/**
- * Retrieves unread entries for a user
+ * Retrieves unread entries for a user.
*
* @param int $userId
* @param int $firstResult
->leftJoin('e.user', 'u')
->where('e.isArchived = false')
->andWhere('u.id =:userId')->setParameter('userId', $userId)
- ->orderBy('e.createdAt', 'desc')
+ ->orderBy('e.id', 'desc')
->getQuery();
$paginator = new Paginator($qb);
}
/**
- * Retrieves read entries for a user
+ * Retrieves read entries for a user.
*
* @param int $userId
* @param int $firstResult
->leftJoin('e.user', 'u')
->where('e.isArchived = true')
->andWhere('u.id =:userId')->setParameter('userId', $userId)
- ->orderBy('e.createdAt', 'desc')
+ ->orderBy('e.id', 'desc')
->getQuery();
$paginator = new Paginator($qb);
}
/**
- * Retrieves starred entries for a user
+ * Retrieves starred entries for a user.
*
* @param int $userId
* @param int $firstResult
->leftJoin('e.user', 'u')
->where('e.isStarred = true')
->andWhere('u.id =:userId')->setParameter('userId', $userId)
- ->orderBy('e.createdAt', 'desc')
+ ->orderBy('e.id', 'desc')
->getQuery();
$paginator = new Paginator($qb);
}
/**
- * Find Entries
+ * Find Entries.
*
* @param int $userId
* @param bool $isArchived
}
if ('created' === $sort) {
- $qb->orderBy('e.createdAt', $order);
+ $qb->orderBy('e.id', $order);
} elseif ('updated' === $sort) {
$qb->orderBy('e.updatedAt', $order);
}