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