Completed
Push — master ( ebc8e7...c63252 )
by Beñat
05:58
created

DoctrineORMListOfIdsSpecification::buildQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the BenGorFile package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace BenGorFile\DoctrineORMBridge\Infrastructure\Persistence;
14
15
use Doctrine\ORM\QueryBuilder;
16
17
/**
18
 * @author Beñat Espiña <[email protected]>
19
 */
20
class DoctrineORMListOfIdsSpecification implements DoctrineORMQuerySpecification
21
{
22
    private $ids;
23
24
    public function __construct(array $ids)
25
    {
26
        $this->ids = $ids;
27
    }
28
29
    public function buildQuery(QueryBuilder $queryBuilder)
30
    {
31
        return $queryBuilder
32
            ->select('f')
33
            ->where($queryBuilder->expr()->in('f.id', ':ids'))
34
            ->setParameter('ids', $this->ids)
35
            ->getQuery();
36
    }
37
}
38