forked from wallabag/wallabag
some parameters, new entry form, etc.
This commit is contained in:
@ -8,6 +8,14 @@ use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||
|
||||
class EntriesRepository extends EntityRepository
|
||||
{
|
||||
/**
|
||||
* Retrieves unread entries for a user
|
||||
*
|
||||
* @param $userId
|
||||
* @param $firstResult
|
||||
* @param int $maxResults
|
||||
* @return Paginator
|
||||
*/
|
||||
public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e')
|
||||
@ -18,11 +26,19 @@ class EntriesRepository extends EntityRepository
|
||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||
->getQuery();
|
||||
|
||||
$pag = new Paginator($qb);
|
||||
$paginator = new Paginator($qb);
|
||||
|
||||
return $pag;
|
||||
return $paginator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves read entries for a user
|
||||
*
|
||||
* @param $userId
|
||||
* @param $firstResult
|
||||
* @param int $maxResults
|
||||
* @return Paginator
|
||||
*/
|
||||
public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e')
|
||||
@ -31,12 +47,21 @@ class EntriesRepository extends EntityRepository
|
||||
->setMaxResults($maxResults)
|
||||
->where('e.isRead = 1')
|
||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||
->getQuery()
|
||||
->getResult(Query::HYDRATE_ARRAY);
|
||||
->getQuery();
|
||||
|
||||
return $qb;
|
||||
$paginator = new Paginator($qb);
|
||||
|
||||
return $paginator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves starred entries for a user
|
||||
*
|
||||
* @param $userId
|
||||
* @param $firstResult
|
||||
* @param int $maxResults
|
||||
* @return Paginator
|
||||
*/
|
||||
public function findStarredByUser($userId, $firstResult, $maxResults = 12)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e')
|
||||
@ -45,9 +70,10 @@ class EntriesRepository extends EntityRepository
|
||||
->setMaxResults($maxResults)
|
||||
->where('e.isFav = 1')
|
||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||
->getQuery()
|
||||
->getResult(Query::HYDRATE_ARRAY);
|
||||
->getQuery();
|
||||
|
||||
return $qb;
|
||||
$paginator = new Paginator($qb);
|
||||
|
||||
return $paginator;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user