aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/WallabagBundle/Repository/EntriesRepository.php
blob: 4c13c9c2fd65f07fa6b104207a3f990714e556a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?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)
    {
        return $this->createQueryBuilder('e')
            ->where('e.is_read = 0')
            ->andWhere('e.user_id = :userId')
            ->setParameter('userId', $userId)
            ->getQuery();
    }*/
    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;
    }
}