|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ControleOnline\Repository; |
|
4
|
|
|
|
|
5
|
|
|
use ControleOnline\Entity\Particulars\Particulars; |
|
6
|
|
|
use ControleOnline\Entity\People; |
|
7
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
|
|
|
|
|
|
8
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
|
|
|
|
|
|
9
|
|
|
use Doctrine\ORM\Query\ResultSetMapping; |
|
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @method Particulars|null find($id, $lockMode = null, $lockVersion = null) |
|
13
|
|
|
* @method Particulars|null findOneBy(array $criteria, array $orderBy = null) |
|
14
|
|
|
* @method Particulars[] findAll() |
|
15
|
|
|
* @method Particulars[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
|
16
|
|
|
*/ |
|
17
|
|
|
class ParticularsRepository extends ServiceEntityRepository |
|
18
|
|
|
{ |
|
19
|
|
|
public function __construct(ManagerRegistry $registry) |
|
20
|
|
|
{ |
|
21
|
|
|
parent::__construct($registry, Particulars::class); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function getParticularsByPeopleAndFieldType(People $people, array $fieldTypes): array |
|
25
|
|
|
{ |
|
26
|
|
|
$sql = " |
|
27
|
|
|
SELECT |
|
28
|
|
|
par.id, |
|
29
|
|
|
pty.id AS type_id, |
|
30
|
|
|
pty.type_value, |
|
31
|
|
|
par.particular_value AS value |
|
32
|
|
|
FROM particulars par |
|
33
|
|
|
INNER JOIN particulars_type pty ON pty.id = par.particulars_type_id |
|
34
|
|
|
WHERE |
|
35
|
|
|
par.people_id = :people_id AND pty.field_type IN (:field_types) |
|
36
|
|
|
"; |
|
37
|
|
|
|
|
38
|
|
|
$rsm = new ResultSetMapping(); |
|
39
|
|
|
|
|
40
|
|
|
$rsm->addScalarResult('id' , 'id' , 'integer'); |
|
41
|
|
|
$rsm->addScalarResult('type_id' , 'type_id' , 'integer'); |
|
42
|
|
|
$rsm->addScalarResult('type_value', 'type_value', 'string'); |
|
43
|
|
|
$rsm->addScalarResult('value' , 'value' , 'string'); |
|
44
|
|
|
|
|
45
|
|
|
$nqu = $this->getEntityManager()->createNativeQuery($sql, $rsm); |
|
46
|
|
|
|
|
47
|
|
|
$nqu->setParameter('people_id' , $people->getId()); |
|
48
|
|
|
$nqu->setParameter('field_types', $fieldTypes); |
|
49
|
|
|
|
|
50
|
|
|
return $nqu->getArrayResult(); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function getParticularsByPeopleAndContext(People $people, string $context): array |
|
54
|
|
|
{ |
|
55
|
|
|
$sql = " |
|
56
|
|
|
SELECT |
|
57
|
|
|
par.id, |
|
58
|
|
|
pty.id AS type_id, |
|
59
|
|
|
pty.type_value, |
|
60
|
|
|
par.particular_value AS value |
|
61
|
|
|
FROM particulars par |
|
62
|
|
|
INNER JOIN particulars_type pty ON pty.id = par.particulars_type_id |
|
63
|
|
|
WHERE |
|
64
|
|
|
par.people_id = :people_id AND pty.context LIKE :context |
|
65
|
|
|
"; |
|
66
|
|
|
|
|
67
|
|
|
$rsm = new ResultSetMapping(); |
|
68
|
|
|
|
|
69
|
|
|
$rsm->addScalarResult('id' , 'id' , 'integer'); |
|
70
|
|
|
$rsm->addScalarResult('type_id' , 'type_id' , 'integer'); |
|
71
|
|
|
$rsm->addScalarResult('type_value', 'type_value', 'string'); |
|
72
|
|
|
$rsm->addScalarResult('value' , 'value' , 'string'); |
|
73
|
|
|
|
|
74
|
|
|
$nqu = $this->getEntityManager()->createNativeQuery($sql, $rsm); |
|
75
|
|
|
|
|
76
|
|
|
$nqu->setParameter('people_id', $people->getId()); |
|
77
|
|
|
$nqu->setParameter('context' , '%' . $context . '%'); |
|
78
|
|
|
|
|
79
|
|
|
return $nqu->getArrayResult(); |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths