Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 33 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
Processus | |
0.00% |
0 / 33 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
getModelClass | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
findAllWithQuestions | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |||
findOneByPosition | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
2 | |||
findNewNotUsedInGivenConformite | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace App\Infrastructure\ORM\Registry\Repository\ConformiteOrganisation; |
4 | |
5 | use App\Application\Doctrine\Repository\CRUDRepository; |
6 | use App\Domain\Registry\Model\ConformiteOrganisation as Model; |
7 | use App\Domain\Registry\Repository\ConformiteOrganisation as Repository; |
8 | |
9 | class Processus extends CRUDRepository implements Repository\Processus |
10 | { |
11 | protected function getModelClass(): string |
12 | { |
13 | return Model\Processus::class; |
14 | } |
15 | |
16 | public function findAllWithQuestions() |
17 | { |
18 | return $this->getManager() |
19 | ->createQueryBuilder() |
20 | ->select('p') |
21 | ->addSelect('q') |
22 | ->from($this->getModelClass(), 'p') |
23 | ->orderBy('p.position') |
24 | ->leftJoin('p.questions', 'q') |
25 | ->getQuery() |
26 | ->getResult() |
27 | ; |
28 | } |
29 | |
30 | public function findOneByPosition(int $position) |
31 | { |
32 | return $this->getManager() |
33 | ->createQueryBuilder() |
34 | ->select('p') |
35 | ->from($this->getModelClass(), 'p') |
36 | ->andWhere('p.position = :position') |
37 | ->setParameter('position', $position) |
38 | ->getQuery() |
39 | ->getOneOrNullResult() |
40 | ; |
41 | } |
42 | |
43 | public function findNewNotUsedInGivenConformite(Model\Evaluation $evaluation) |
44 | { |
45 | $qb = $this->createQueryBuilder(); |
46 | $qb->andWhere($qb->expr()->notIn('o.id', ':processus')) |
47 | ->setParameter( |
48 | 'processus', |
49 | array_map(function (Model\Conformite $conformite) { |
50 | return $conformite->getProcessus()->getId()->toString(); |
51 | }, \iterable_to_array($evaluation->getConformites())) |
52 | ) |
53 | ; |
54 | |
55 | return $qb |
56 | ->getQuery() |
57 | ->getResult() |
58 | ; |
59 | } |
60 | } |