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\Suppliers; |
18
|
|
|
use Administration\Domain\Supplier\Model\Supplier as SupplierModel; |
19
|
|
|
use Administration\Domain\Supplier\Model\VO\SupplierUuid; |
20
|
|
|
use Core\Domain\Common\Model\VO\EmailField; |
21
|
|
|
use Core\Domain\Common\Model\VO\NameField; |
22
|
|
|
use Core\Domain\Common\Model\VO\PhoneField; |
23
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
|
|
|
|
24
|
|
|
use Doctrine\ORM\NonUniqueResultException; |
|
|
|
|
25
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
|
|
|
|
26
|
|
|
|
27
|
|
|
class DoctrineSupplierFinder extends ServiceEntityRepository implements SupplierFinderProtocol |
28
|
|
|
{ |
29
|
|
|
public function __construct(ManagerRegistry $registry) |
30
|
|
|
{ |
31
|
|
|
parent::__construct($registry, SupplierModel::class); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @throws NonUniqueResultException |
36
|
|
|
*/ |
37
|
|
|
public function findOneByUuid(string $uuid): SupplierModel |
38
|
|
|
{ |
39
|
|
|
$result = $this->createQueryBuilder('s') |
40
|
|
|
->where('s.uuid = :uuid') |
41
|
|
|
->setParameter('uuid', $uuid) |
42
|
|
|
->getQuery() |
43
|
|
|
->getOneOrNullResult() |
44
|
|
|
; |
45
|
|
|
|
46
|
|
|
return new SupplierModel( |
47
|
|
|
SupplierUuid::fromString($result->getUuid()), |
48
|
|
|
NameField::fromString($result->getName()), |
49
|
|
|
$result->getAddress(), |
50
|
|
|
$result->getZipCode(), |
51
|
|
|
$result->getTown(), |
52
|
|
|
$result->getCountry(), |
53
|
|
|
PhoneField::fromString($result->getPhone()), |
54
|
|
|
PhoneField::fromString($result->getFacsimile()), |
55
|
|
|
EmailField::fromString($result->getEmail()), |
56
|
|
|
$result->getContact(), |
57
|
|
|
PhoneField::fromString($result->getCellphone()), |
58
|
|
|
$result->getFamilyLog(), |
59
|
|
|
$result->getDelayDelivery(), |
60
|
|
|
$result->getOrderDay() |
61
|
|
|
); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function findAllActive(): Suppliers |
65
|
|
|
{ |
66
|
|
|
$statement = $this->createQueryBuilder('s') |
67
|
|
|
->getQuery() |
68
|
|
|
->getResult() |
69
|
|
|
; |
70
|
|
|
|
71
|
|
|
return new Suppliers( |
72
|
|
|
...\array_map(static function (SupplierModel $supplier) { |
73
|
|
|
return new SupplierModel( |
74
|
|
|
$supplier->uuid(), |
|
|
|
|
75
|
|
|
$supplier->name(), |
|
|
|
|
76
|
|
|
$supplier->address(), |
77
|
|
|
$supplier->zipCode(), |
78
|
|
|
$supplier->town(), |
79
|
|
|
$supplier->country(), |
80
|
|
|
$supplier->phone(), |
|
|
|
|
81
|
|
|
$supplier->facsimile(), |
|
|
|
|
82
|
|
|
$supplier->email(), |
|
|
|
|
83
|
|
|
$supplier->contact(), |
84
|
|
|
$supplier->cellphone(), |
|
|
|
|
85
|
|
|
$supplier->familyLog(), |
86
|
|
|
$supplier->delayDelivery(), |
87
|
|
|
$supplier->orderDays() |
|
|
|
|
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