Completed
Push — master ( 6cec30...bddb48 )
by nicolas
11s
created

ApiCacheRepository::findOneByKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 9
rs 9.6666
c 1
b 0
f 1
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace Dekalee\AdbackAnalyticsBundle\Repository;
4
5
use Dekalee\AdbackAnalyticsBundle\Entity\ApiCache;
6
7
/**
8
 * Class ApiCacheRepository
9
 */
10
class ApiCacheRepository extends \Doctrine\ORM\EntityRepository
11
{
12
    /**
13
     * @param string $key
14
     *
15
     * @return null|ApiCache
16
     */
17
    public function findOneByKey($key)
18
    {
19
        $qb = $this->createQueryBuilder('a');
20
21
        $qb->andWhere($qb->expr()->eq('a.key', ':key'));
22
        $qb->setParameter('key', $key);
23
24
        return $qb->getQuery()->getOneOrNullResult();
25
    }
26
}
27