|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the G.L.S.R. Apps package. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) Dev-Int Création <[email protected]>. |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Administration\Infrastructure\Finders\Doctrine; |
|
15
|
|
|
|
|
16
|
|
|
use Administration\Application\Company\ReadModel\Companies; |
|
17
|
|
|
use Administration\Application\Company\ReadModel\Company as CompanyModel; |
|
18
|
|
|
use Administration\Application\Protocol\Finders\CompanyFinderProtocol; |
|
19
|
|
|
use Doctrine\DBAL\Connection; |
|
|
|
|
|
|
20
|
|
|
use Doctrine\DBAL\Driver\Exception; |
|
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
class DoctrineCompanyFinder implements CompanyFinderProtocol |
|
23
|
|
|
{ |
|
24
|
|
|
private Connection $connection; |
|
25
|
|
|
|
|
26
|
|
|
public function __construct(Connection $connection) |
|
27
|
|
|
{ |
|
28
|
|
|
$this->connection = $connection; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @throws Exception |
|
33
|
|
|
* @throws \Doctrine\DBAL\Exception |
|
34
|
|
|
*/ |
|
35
|
|
|
public function findByUuid(string $uuid): CompanyModel |
|
36
|
|
|
{ |
|
37
|
|
|
$query = <<<'SQL' |
|
38
|
|
|
SELECT |
|
39
|
|
|
company.uuid as uuid, |
|
40
|
|
|
company.name as name, |
|
41
|
|
|
company.address as address, |
|
42
|
|
|
company.zip_code as zipCode, |
|
43
|
|
|
company.town as town, |
|
44
|
|
|
company.country as country, |
|
45
|
|
|
company.phone as phone, |
|
46
|
|
|
company.facsimile as facsimile, |
|
47
|
|
|
company.email as email, |
|
48
|
|
|
company.contact_name as contactName, |
|
49
|
|
|
company.cellphone as cellphone, |
|
50
|
|
|
company.slug as slug |
|
51
|
|
|
FROM company |
|
52
|
|
|
WHERE uuid = :uuid |
|
53
|
|
|
SQL; |
|
54
|
|
|
$result = $this->connection->executeQuery($query, ['uuid' => $uuid])->fetchOne(); |
|
55
|
|
|
|
|
56
|
|
|
return new CompanyModel( |
|
57
|
|
|
$result['uuid'], |
|
58
|
|
|
$result['name'], |
|
59
|
|
|
$result['address'], |
|
60
|
|
|
$result['zipCode'], |
|
61
|
|
|
$result['town'], |
|
62
|
|
|
$result['country'], |
|
63
|
|
|
$result['phone'], |
|
64
|
|
|
$result['facsimile'], |
|
65
|
|
|
$result['email'], |
|
66
|
|
|
$result['contactName'], |
|
67
|
|
|
$result['cellphone'], |
|
68
|
|
|
$result['slug'] |
|
69
|
|
|
); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @throws \Doctrine\DBAL\Exception|Exception |
|
74
|
|
|
*/ |
|
75
|
|
|
public function findAll(): Companies |
|
76
|
|
|
{ |
|
77
|
|
|
$query = <<<'SQL' |
|
78
|
|
|
SELECT |
|
79
|
|
|
company.uuid as uuid, |
|
80
|
|
|
company.name as name, |
|
81
|
|
|
company.address as address, |
|
82
|
|
|
company.zip_code as zipCode, |
|
83
|
|
|
company.town as town, |
|
84
|
|
|
company.country as country, |
|
85
|
|
|
company.phone as phone, |
|
86
|
|
|
company.facsimile as facsimile, |
|
87
|
|
|
company.email as email, |
|
88
|
|
|
company.contact_name as contact, |
|
89
|
|
|
company.cellphone as cellphone, |
|
90
|
|
|
company.slug as slug |
|
91
|
|
|
FROM company |
|
92
|
|
|
ORDER BY name |
|
93
|
|
|
SQL; |
|
94
|
|
|
$result = $this->connection->executeQuery($query)->fetchAllAssociative(); |
|
95
|
|
|
|
|
96
|
|
|
return new Companies( |
|
97
|
|
|
...\array_map(static function (array $company) { |
|
98
|
|
|
return new CompanyModel( |
|
99
|
|
|
$company['uuid'], |
|
100
|
|
|
$company['name'], |
|
101
|
|
|
$company['address'], |
|
102
|
|
|
$company['zipCode'], |
|
103
|
|
|
$company['town'], |
|
104
|
|
|
$company['country'], |
|
105
|
|
|
$company['phone'], |
|
106
|
|
|
$company['facsimile'], |
|
107
|
|
|
$company['email'], |
|
108
|
|
|
$company['contact'], |
|
109
|
|
|
$company['cellphone'], |
|
110
|
|
|
$company['slug'] |
|
111
|
|
|
); |
|
112
|
|
|
}, $result) |
|
113
|
|
|
); |
|
114
|
|
|
} |
|
115
|
|
|
} |
|
116
|
|
|
|
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