Completed
Pull Request — master (#30)
by
unknown
05:27 queued 02:31
created

EventRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 2
c 3
b 0
f 1
lcom 0
cbo 2
dl 0
loc 23
ccs 0
cts 19
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A selectNotExpiredByUser() 0 11 1
A findByGoogleId() 0 8 1
1
<?php
2
3
namespace AppBundle\Repository;
4
5
/**
6
 * EventRepository.
7
 *
8
 * This class was generated by the Doctrine ORM. Add your own custom
9
 * repository methods below.
10
 */
11
class EventRepository extends \Doctrine\ORM\EntityRepository
12
{
13
    public function findByGoogleId($id)
14
    {
15
        return $this->createQueryBuilder('e')
16
            ->andWhere('e.googleId = :id')
17
            ->setParameter('id', $id)
18
            ->getQuery()
19
            ->getSingleResult();
20
    }
21
22
    public function selectNotExpiredByUser($user)
23
    {
24
        return $this->createQueryBuilder('e')
25
            ->join('e.user', 'user')
26
            ->andWhere('user = :user')
27
            ->setParameter('user', $user)
28
            ->andWhere('e.expiredAt >= :date')
29
            ->setParameter('date', new \DateTime())
30
            ->getQuery()
31
            ->getResult();
32
    }
33
}
34