1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Repository; |
4
|
|
|
|
5
|
|
|
use ControleOnline\Entity\Address; |
6
|
|
|
use ControleOnline\Entity\People; |
|
|
|
|
7
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
|
|
|
|
8
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
|
|
|
|
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @method Address|null find($id, $lockMode = null, $lockVersion = null) |
12
|
|
|
* @method Address|null findOneBy(array $criteria, array $orderBy = null) |
13
|
|
|
* @method Address[] findAll() |
14
|
|
|
* @method Address[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
15
|
|
|
*/ |
16
|
|
|
class AddressRepository extends ServiceEntityRepository |
17
|
|
|
{ |
18
|
|
|
public function __construct(ManagerRegistry $registry) |
19
|
|
|
{ |
20
|
|
|
parent::__construct($registry, Address::class); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function findOneByCityStateCountryOfPeople(string $city, string $state, string $country, People $people): ?Address |
24
|
|
|
{ |
25
|
|
|
$result = $this->createQueryBuilder('a') |
26
|
|
|
->innerJoin ('a.street' , 's') |
27
|
|
|
->innerJoin ('s.district', 'd') |
28
|
|
|
->innerJoin ('d.city' , 'c') |
29
|
|
|
->innerJoin ('c.state' , 'e') |
30
|
|
|
->innerJoin ('e.country' , 'u') |
31
|
|
|
|
32
|
|
|
->andWhere ('c.city = :city' ) |
33
|
|
|
->andWhere ('e.uf = :state' ) |
34
|
|
|
->andWhere ('u.countryname = :country') |
35
|
|
|
->andWhere ('a.people = :people' ) |
36
|
|
|
|
37
|
|
|
->setParameter ('city' , $city ) |
38
|
|
|
->setParameter ('state' , $state ) |
39
|
|
|
->setParameter ('country', $country) |
40
|
|
|
->setParameter ('people' , $people) |
41
|
|
|
|
42
|
|
|
->getQuery() |
43
|
|
|
->getResult() |
44
|
|
|
; |
45
|
|
|
|
46
|
|
|
if (empty($result)) |
47
|
|
|
return null; |
48
|
|
|
|
49
|
|
|
return $result[0]; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function findPeopleAddressBy(People $people, array $criteria): ?Address |
53
|
|
|
{ |
54
|
|
|
$result = $this->createQueryBuilder('a') |
55
|
|
|
->innerJoin ('a.street' , 's') |
56
|
|
|
->innerJoin ('s.district', 'd') |
57
|
|
|
->innerJoin ('d.city' , 'c') |
58
|
|
|
->innerJoin ('c.state' , 'e') |
59
|
|
|
->innerJoin ('e.country' , 'u') |
60
|
|
|
|
61
|
|
|
->andWhere ('a.people = :people' ) |
62
|
|
|
->andWhere ('u.countryname = :country' ) |
63
|
|
|
->andWhere ('(e.uf = :state OR e.state = :state)') |
64
|
|
|
->andWhere ('c.city = :city' ) |
65
|
|
|
->andWhere ('d.district = :district') |
66
|
|
|
->andWhere ('s.street = :street' ) |
67
|
|
|
->andWhere ('a.number = :number' ) |
68
|
|
|
|
69
|
|
|
->setParameter ('people' , $people) |
70
|
|
|
->setParameter ('country' , $criteria['country'] ) |
71
|
|
|
->setParameter ('state' , $criteria['state'] ) |
72
|
|
|
->setParameter ('city' , $criteria['city'] ) |
73
|
|
|
->setParameter ('district', $criteria['district']) |
74
|
|
|
->setParameter ('street' , $criteria['street'] ) |
75
|
|
|
->setParameter ('number' , $criteria['number'] ) |
76
|
|
|
|
77
|
|
|
->getQuery() |
78
|
|
|
->getResult() |
79
|
|
|
; |
80
|
|
|
|
81
|
|
|
if (empty($result)) |
82
|
|
|
return null; |
83
|
|
|
|
84
|
|
|
return $result[0]; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
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