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\Domain\Supplier\Model; |
15
|
|
|
|
16
|
|
|
use Administration\Domain\Supplier\Model\VO\SupplierUuid; |
17
|
|
|
use Core\Domain\Common\Model\Contact; |
18
|
|
|
use Core\Domain\Common\Model\Dependent\FamilyLog; |
19
|
|
|
use Core\Domain\Common\Model\VO\EmailField; |
20
|
|
|
use Core\Domain\Common\Model\VO\NameField; |
21
|
|
|
use Core\Domain\Common\Model\VO\PhoneField; |
22
|
|
|
|
23
|
|
|
final class Supplier extends Contact |
24
|
|
|
{ |
25
|
|
|
protected string $uuid; |
26
|
|
|
private FamilyLog $familyLog; |
27
|
|
|
private int $delayDelivery; |
28
|
|
|
private array $orderDays; |
29
|
|
|
private bool $active; |
30
|
|
|
|
31
|
|
|
public function __construct( |
32
|
|
|
SupplierUuid $uuid, |
33
|
|
|
NameField $name, |
34
|
|
|
string $address, |
35
|
|
|
string $zipCode, |
36
|
|
|
string $town, |
37
|
|
|
string $country, |
38
|
|
|
PhoneField $phone, |
39
|
|
|
PhoneField $facsimile, |
40
|
|
|
EmailField $email, |
41
|
|
|
string $contact, |
42
|
|
|
PhoneField $cellphone, |
43
|
|
|
FamilyLog $familyLog, |
44
|
|
|
int $delayDelivery, |
45
|
|
|
array $orderDays, |
46
|
|
|
bool $active = true |
47
|
|
|
) { |
48
|
|
|
parent::__construct( |
49
|
|
|
$uuid, |
50
|
|
|
$name, |
51
|
|
|
$address, |
52
|
|
|
$zipCode, |
53
|
|
|
$town, |
54
|
|
|
$country, |
55
|
|
|
$phone, |
56
|
|
|
$facsimile, |
57
|
|
|
$email, |
58
|
|
|
$contact, |
59
|
|
|
$cellphone |
60
|
|
|
); |
61
|
|
|
$this->familyLog = $familyLog; |
62
|
|
|
$this->delayDelivery = $delayDelivery; |
63
|
|
|
$this->orderDays = $orderDays; |
64
|
|
|
$this->active = $active; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public static function create( |
68
|
|
|
SupplierUuid $uuid, |
69
|
|
|
NameField $name, |
70
|
|
|
string $address, |
71
|
|
|
string $zipCode, |
72
|
|
|
string $town, |
73
|
|
|
string $country, |
74
|
|
|
PhoneField $phone, |
75
|
|
|
PhoneField $facsimile, |
76
|
|
|
EmailField $email, |
77
|
|
|
string $contact, |
78
|
|
|
PhoneField $gsm, |
79
|
|
|
FamilyLog $familyLog, |
80
|
|
|
int $delayDelivery, |
81
|
|
|
array $orderDays, |
82
|
|
|
bool $active = true |
83
|
|
|
): self { |
84
|
|
|
return new self( |
85
|
|
|
$uuid, |
86
|
|
|
$name, |
87
|
|
|
$address, |
88
|
|
|
$zipCode, |
89
|
|
|
$town, |
90
|
|
|
$country, |
91
|
|
|
$phone, |
92
|
|
|
$facsimile, |
93
|
|
|
$email, |
94
|
|
|
$contact, |
95
|
|
|
$gsm, |
96
|
|
|
$familyLog, |
97
|
|
|
$delayDelivery, |
98
|
|
|
$orderDays, |
99
|
|
|
$active |
100
|
|
|
); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function renameSupplier(NameField $name): void |
104
|
|
|
{ |
105
|
|
|
$this->name = $name->getValue(); |
106
|
|
|
$this->slug = $name->slugify(); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function familyLog(): FamilyLog |
110
|
|
|
{ |
111
|
|
|
return $this->familyLog; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function setFamilyLog(FamilyLog $familyLog): void |
115
|
|
|
{ |
116
|
|
|
$this->familyLog = $familyLog; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function delayDelivery(): int |
120
|
|
|
{ |
121
|
|
|
return $this->delayDelivery; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function setDelayDelivery(int $delayDelivery): void |
125
|
|
|
{ |
126
|
|
|
$this->delayDelivery = $delayDelivery; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function getOrderDays(): array |
130
|
|
|
{ |
131
|
|
|
return $this->orderDays; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function setOrderDays(array $orderDays): void |
135
|
|
|
{ |
136
|
|
|
$this->orderDays = $orderDays; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function isActive(): bool |
140
|
|
|
{ |
141
|
|
|
return $this->active; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
public function setActive(bool $active): void |
145
|
|
|
{ |
146
|
|
|
$this->active = $active; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public function getSlug(): string |
150
|
|
|
{ |
151
|
|
|
return $this->slug; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
public function setSlug(string $slug): void |
155
|
|
|
{ |
156
|
|
|
$this->slug = $slug; |
157
|
|
|
} |
158
|
|
|
} |
159
|
|
|
|