1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

toggle archive / fav actions

This commit is contained in:
Nicolas Lœuillet 2015-01-23 12:45:24 +01:00
parent bd9f08157c
commit 163eae0bb1
12 changed files with 268 additions and 44 deletions

View file

@ -4,31 +4,31 @@ namespace WallabagBundle\Repository;
use Doctrine\ORM\Query;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Tools\Pagination\Paginator;
/**
* EntriesRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class EntriesRepository extends EntityRepository
{
public function findUnreadByUser($userId)
public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
{
$qb = $this->createQueryBuilder('e')
->select('e')
->setFirstResult($firstResult)
->setMaxResults($maxResults)
->where('e.isRead = 0')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
->getQuery()
->getResult(Query::HYDRATE_ARRAY);
->getQuery();
return $qb;
$pag = new Paginator($qb);
return $pag;
}
public function findArchiveByUser($userId)
public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
{
$qb = $this->createQueryBuilder('e')
->select('e')
->setFirstResult($firstResult)
->setMaxResults($maxResults)
->where('e.isRead = 1')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
->getQuery()
@ -37,10 +37,12 @@ class EntriesRepository extends EntityRepository
return $qb;
}
public function findStarredByUser($userId)
public function findStarredByUser($userId, $firstResult, $maxResults = 12)
{
$qb = $this->createQueryBuilder('e')
->select('e')
->setFirstResult($firstResult)
->setMaxResults($maxResults)
->where('e.isFav = 1')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
->getQuery()