findSpecification()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @author Rafał Muszyński <[email protected]>
5
 * @copyright 2015 Sourcefabric z.ú.
6
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
7
 */
8
namespace Newscoop\PaywallBundle\Entity\Repository;
9
10
use Doctrine\ORM\EntityRepository;
11
12
/**
13
 * Subscription Specification repository.
14
 */
15
class SubscriptionSpecificationRepository extends EntityRepository
16
{
17
    public function findSpecification($articleNumber, $publicationId)
18
    {
19
        $queryBuilder = $this->createQueryBuilder('ss')
20
                ->join('ss.subscription', 's')
21
                ->where('ss.article = :article')
22
                ->andWhere('ss.publication = :publication')
23
                ->andWhere('s.is_active = true')
24
                ->setParameters(array(
25
                    'article' => $articleNumber,
26
                    'publication' => $publicationId,
27
                ));
28
29
        return $queryBuilder->getQuery()->getOneOrNullResult();
30
    }
31
}
32