DoctrineORMListOfIdsSpecification   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A buildQuery() 0 8 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