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\DoctrineOrm; |
15
|
|
|
|
16
|
|
|
use Administration\Application\Protocol\Finders\SupplierFinderProtocol; |
17
|
|
|
use Administration\Application\Supplier\ReadModel\Supplier as SupplierReadModel; |
18
|
|
|
use Administration\Application\Supplier\ReadModel\Suppliers; |
19
|
|
|
use Administration\Infrastructure\Persistence\DoctrineOrm\Entities\Supplier; |
20
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
|
|
|
|
21
|
|
|
use Doctrine\ORM\NonUniqueResultException; |
|
|
|
|
22
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
|
|
|
|
23
|
|
|
|
24
|
|
|
class DoctrineSupplierFinder extends ServiceEntityRepository implements SupplierFinderProtocol |
25
|
|
|
{ |
26
|
|
|
public function __construct(ManagerRegistry $registry) |
27
|
|
|
{ |
28
|
|
|
parent::__construct($registry, Supplier::class); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @throws NonUniqueResultException |
33
|
|
|
*/ |
34
|
|
|
public function findOneByUuid(string $uuid): SupplierReadModel |
35
|
|
|
{ |
36
|
|
|
$result = $this->createQueryBuilder('s') |
37
|
|
|
->where('s.uuid = :uuid') |
38
|
|
|
->setParameter('uuid', $uuid) |
39
|
|
|
->getQuery() |
40
|
|
|
->getOneOrNullResult() |
41
|
|
|
; |
42
|
|
|
|
43
|
|
|
return new SupplierReadModel( |
44
|
|
|
$result->getUuid(), |
45
|
|
|
$result->getName(), |
46
|
|
|
$result->getAddress(), |
47
|
|
|
$result->getZipCode(), |
48
|
|
|
$result->getTown(), |
49
|
|
|
$result->getCountry(), |
50
|
|
|
$result->getPhone(), |
51
|
|
|
$result->getFacsimile(), |
52
|
|
|
$result->getEmail(), |
53
|
|
|
$result->getContact(), |
54
|
|
|
$result->getCellphone(), |
55
|
|
|
$result->getFamilyLog(), |
56
|
|
|
$result->getDelayDelivery(), |
57
|
|
|
$result->getOrderDay(), |
58
|
|
|
$result->getSlug() |
59
|
|
|
); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function findAllActive(): Suppliers |
63
|
|
|
{ |
64
|
|
|
$statement = $this->createQueryBuilder('s') |
65
|
|
|
->where('s.active = 1') |
66
|
|
|
->getQuery() |
67
|
|
|
->getResult() |
68
|
|
|
; |
69
|
|
|
|
70
|
|
|
return new Suppliers( |
71
|
|
|
...\array_map(static function (Supplier $supplier) { |
72
|
|
|
return new SupplierReadModel( |
73
|
|
|
$supplier->getUuid(), |
74
|
|
|
$supplier->getCompanyName(), |
75
|
|
|
$supplier->getAddress(), |
76
|
|
|
$supplier->getZipCode(), |
77
|
|
|
$supplier->getTown(), |
78
|
|
|
$supplier->getCountry(), |
79
|
|
|
$supplier->getPhone(), |
80
|
|
|
$supplier->getFacsimile(), |
81
|
|
|
$supplier->getEmail(), |
82
|
|
|
$supplier->getContactName(), |
83
|
|
|
$supplier->getCellphone(), |
84
|
|
|
$supplier->getFamilyLog(), |
85
|
|
|
$supplier->getDelayDelivery(), |
86
|
|
|
$supplier->getOrderDays(), |
87
|
|
|
$supplier->getSlug() |
88
|
|
|
); |
89
|
|
|
}, $statement) |
90
|
|
|
); |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|
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