aboutsummaryrefslogblamecommitdiffhomepage
path: root/src/WallabagBundle/Repository/EntriesRepository.php
blob: c355a012c61dd51a68ccc0a1e914f4d9468e3a42 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                    










                                                                            























                                                                            
 
<?php

namespace WallabagBundle\Repository;

use Doctrine\ORM\Query;
use Doctrine\ORM\EntityRepository;

/**
 * EntriesRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class EntriesRepository extends EntityRepository
{
    public function findUnreadByUser($userId)
    {
        $qb = $this->createQueryBuilder('e')
            ->select('e')
            ->where('e.isRead = 0')
            ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
            ->getQuery()
            ->getResult(Query::HYDRATE_ARRAY);

        return $qb;
    }

    public function findArchiveByUser($userId)
    {
        $qb = $this->createQueryBuilder('e')
            ->select('e')
            ->where('e.isRead = 1')
            ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
            ->getQuery()
            ->getResult(Query::HYDRATE_ARRAY);

        return $qb;
    }

    public function findStarredByUser($userId)
    {
        $qb = $this->createQueryBuilder('e')
            ->select('e')
            ->where('e.isFav = 1')
            ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
            ->getQuery()
            ->getResult(Query::HYDRATE_ARRAY);

        return $qb;
    }
}