|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Entity Supplier. |
|
5
|
|
|
* |
|
6
|
|
|
* PHP Version 7 |
|
7
|
|
|
* |
|
8
|
|
|
* @author Quétier Laurent <[email protected]> |
|
9
|
|
|
* @copyright 2018 Dev-Int GLSR |
|
10
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
|
11
|
|
|
* |
|
12
|
|
|
* @version GIT: $Id$ |
|
13
|
|
|
* |
|
14
|
|
|
* @link https://github.com/Dev-Int/glsr |
|
15
|
|
|
*/ |
|
16
|
|
|
namespace App\Entity\Settings; |
|
17
|
|
|
|
|
18
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
19
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
20
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
|
21
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
|
22
|
|
|
use App\Entity\Contact; |
|
23
|
|
|
use App\Entity\Settings\Diverse\FamilyLog; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Supplier Entity. |
|
27
|
|
|
* |
|
28
|
|
|
* @category Entity |
|
29
|
|
|
* |
|
30
|
|
|
* @ORM\Table(name="app_supplier") |
|
31
|
|
|
* @ORM\Entity(repositoryClass="App\Repository\Settings\SupplierRepository") |
|
32
|
|
|
* @UniqueEntity( |
|
33
|
|
|
* fields="name", |
|
34
|
|
|
* message="This supplier name is already used in the system." |
|
35
|
|
|
* ) |
|
36
|
|
|
*/ |
|
37
|
|
|
class Supplier extends Contact |
|
38
|
|
|
{ |
|
39
|
|
|
/** |
|
40
|
|
|
* @var int id supplier |
|
41
|
|
|
* |
|
42
|
|
|
* @ORM\Column(name="id", type="integer") |
|
43
|
|
|
* @ORM\Id |
|
44
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
|
45
|
|
|
*/ |
|
46
|
|
|
private $id; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var string|\App\Entity\Settings\Diverse\FamilyLog Famille logistique |
|
50
|
|
|
* @ORM\ManyToOne(targetEntity="App\Entity\Settings\Diverse\FamilyLog") |
|
51
|
|
|
* @ORM\OrderBy({"path" = "asc"}) |
|
52
|
|
|
* @Assert\NotBlank() |
|
53
|
|
|
*/ |
|
54
|
|
|
private $familyLog; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @var int Delivery time |
|
58
|
|
|
* |
|
59
|
|
|
* @ORM\Column(name="delaydeliv", type="smallint") |
|
60
|
|
|
* @Assert\Length( |
|
61
|
|
|
* max="1", |
|
62
|
|
|
* maxMessage = "Votre choix ne peut pas être que {{ limit }} caractère" |
|
63
|
|
|
* ) |
|
64
|
|
|
* @Assert\NotBlank() |
|
65
|
|
|
*/ |
|
66
|
|
|
private $delaydeliv; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var array Table of order days |
|
70
|
|
|
* |
|
71
|
|
|
* @ORM\Column(name="orderdate", type="simple_array") |
|
72
|
|
|
* @Assert\NotBlank(message="Il vous faut choisir au moins 1 date de commande.") |
|
73
|
|
|
*/ |
|
74
|
|
|
private $orderdate; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @var bool On/Off |
|
78
|
|
|
* |
|
79
|
|
|
* @ORM\Column(name="active", type="boolean") |
|
80
|
|
|
*/ |
|
81
|
|
|
private $active; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @Gedmo\Slug(fields={"name"}, updatable=false) |
|
85
|
|
|
* @ORM\Column(length=128, unique=true) |
|
86
|
|
|
*/ |
|
87
|
|
|
private $slug; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* __construct. |
|
91
|
|
|
*/ |
|
92
|
|
|
public function __construct() |
|
93
|
|
|
{ |
|
94
|
|
|
$this->active = true; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Get id |
|
99
|
|
|
* |
|
100
|
|
|
* @return integer |
|
101
|
|
|
*/ |
|
102
|
|
|
public function getId() |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->id; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* Set delaydeliv. |
|
109
|
|
|
* |
|
110
|
|
|
* @param int $delaydeliv Delivery time |
|
111
|
|
|
* |
|
112
|
|
|
* @return Supplier |
|
113
|
|
|
*/ |
|
114
|
|
|
public function setDelaydeliv($delaydeliv) |
|
115
|
|
|
{ |
|
116
|
|
|
$this->delaydeliv = $delaydeliv; |
|
117
|
|
|
return $this; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Get delaydeliv. |
|
122
|
|
|
* |
|
123
|
|
|
* @return int |
|
124
|
|
|
*/ |
|
125
|
|
|
public function getDelaydeliv() |
|
126
|
|
|
{ |
|
127
|
|
|
return $this->delaydeliv; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* Set orderdate. |
|
132
|
|
|
* |
|
133
|
|
|
* @param array $orderdate Order day(s) |
|
134
|
|
|
* |
|
135
|
|
|
* @return Supplier |
|
136
|
|
|
*/ |
|
137
|
|
|
public function setOrderdate($orderdate) |
|
138
|
|
|
{ |
|
139
|
|
|
$this->orderdate = $orderdate; |
|
140
|
|
|
return $this; |
|
141
|
|
|
} |
|
142
|
|
|
/** |
|
143
|
|
|
* Get orderdate. |
|
144
|
|
|
* |
|
145
|
|
|
* @return array |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getOrderdate() |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->orderdate; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* Set familyLog. |
|
154
|
|
|
* |
|
155
|
|
|
* @param null|\App\Entity\Settings\Diverse\FamilyLog $familyLog Logistic family |
|
156
|
|
|
* |
|
157
|
|
|
* @return Supplier |
|
158
|
|
|
*/ |
|
159
|
|
|
public function setFamilyLog(FamilyLog $familyLog = null) |
|
160
|
|
|
{ |
|
161
|
|
|
$this->familyLog = $familyLog; |
|
162
|
|
|
return $this; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* Get familyLog. |
|
167
|
|
|
* |
|
168
|
|
|
* @return \App\Entity\Settings\Diverse\FamilyLog |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getFamilyLog() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->familyLog; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Get slug |
|
177
|
|
|
* |
|
178
|
|
|
* @return string |
|
179
|
|
|
*/ |
|
180
|
|
|
public function getSlug() |
|
181
|
|
|
{ |
|
182
|
|
|
return $this->slug; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* Set active. |
|
187
|
|
|
* |
|
188
|
|
|
* @param bool $active On/off |
|
189
|
|
|
* |
|
190
|
|
|
* @return Supplier |
|
191
|
|
|
*/ |
|
192
|
|
|
public function setActive($active) |
|
193
|
|
|
{ |
|
194
|
|
|
$this->active = $active; |
|
195
|
|
|
return $this; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* Is active. |
|
200
|
|
|
* |
|
201
|
|
|
* @return bool |
|
202
|
|
|
*/ |
|
203
|
|
|
public function isActive() |
|
204
|
|
|
{ |
|
205
|
|
|
return $this->active; |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
/** |
|
209
|
|
|
* This method lets you do "echo $supplier". |
|
210
|
|
|
* <p> So, to "show" $supplier, |
|
211
|
|
|
* PHP will actually show the return of this method. <br /> |
|
212
|
|
|
* Here, the name, so "echo $supplier" |
|
213
|
|
|
* is equivalent to "echo $supplier->getName()" </p>. |
|
214
|
|
|
* |
|
215
|
|
|
* @return string name |
|
216
|
|
|
*/ |
|
217
|
|
|
public function __toString() |
|
218
|
|
|
{ |
|
219
|
|
|
return $this->getName(); |
|
220
|
|
|
} |
|
221
|
|
|
} |
|
222
|
|
|
|