|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* SuperClass Entity Contact. |
|
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; |
|
17
|
|
|
|
|
18
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
19
|
|
|
use Misd\PhoneNumberBundle\Validator\Constraints\PhoneNumber as AssertPhoneNumber; |
|
20
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Contact Entity. |
|
24
|
|
|
* |
|
25
|
|
|
* @category Entity |
|
26
|
|
|
* |
|
27
|
|
|
* @ORM\MappedSuperclass |
|
28
|
|
|
*/ |
|
29
|
|
|
class Contact |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* @var string name nom de l'entreprise |
|
33
|
|
|
* |
|
34
|
|
|
* @ORM\Column(name="name", type="string", length=255) |
|
35
|
|
|
*/ |
|
36
|
|
|
private $name; |
|
37
|
|
|
|
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var string Addresse de l'entreprise |
|
41
|
|
|
* |
|
42
|
|
|
* @ORM\Column(name="address", type="string", length=255) |
|
43
|
|
|
*/ |
|
44
|
|
|
private $address; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @var string Code postal |
|
48
|
|
|
* |
|
49
|
|
|
* @ORM\Column(name="zipcode", type="string", length=5) |
|
50
|
|
|
*/ |
|
51
|
|
|
private $zipcode; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var string Ville |
|
55
|
|
|
* |
|
56
|
|
|
* @ORM\Column(name="town", type="string", length=255) |
|
57
|
|
|
*/ |
|
58
|
|
|
private $town; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @var phone_number Téléphone de l'entreprise |
|
62
|
|
|
* |
|
63
|
|
|
* @ORM\Column(name="phone", type="phone_number") |
|
64
|
|
|
* @Assert\NotBlank() |
|
65
|
|
|
* @AssertPhoneNumber(defaultRegion="FR") |
|
66
|
|
|
*/ |
|
67
|
|
|
private $phone; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @var phone_number Fax de l'entreprise |
|
71
|
|
|
* |
|
72
|
|
|
* @ORM\Column(name="fax", type="phone_number") |
|
73
|
|
|
* @Assert\NotBlank() |
|
74
|
|
|
* @AssertPhoneNumber(defaultRegion="FR") |
|
75
|
|
|
*/ |
|
76
|
|
|
private $fax; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @var string email de l'entreprise |
|
80
|
|
|
* |
|
81
|
|
|
* @ORM\Column(name="mail", type="string", length=255) |
|
82
|
|
|
* @Assert\NotBlank() |
|
83
|
|
|
* @Assert\Email( |
|
84
|
|
|
* message = "'{{ value }}' n'est pas un email valide.", |
|
85
|
|
|
* checkMX = true |
|
86
|
|
|
* ) |
|
87
|
|
|
*/ |
|
88
|
|
|
private $email; |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @var string Contact de l'entreprise |
|
92
|
|
|
* |
|
93
|
|
|
* @ORM\Column(name="contact", type="string", length=255) |
|
94
|
|
|
*/ |
|
95
|
|
|
private $contact; |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @var phone_number Gsm de l'entreprise |
|
99
|
|
|
* |
|
100
|
|
|
* @ORM\Column(name="gsm", type="phone_number") |
|
101
|
|
|
* @Assert\NotBlank() |
|
102
|
|
|
* @AssertPhoneNumber(defaultRegion="FR") |
|
103
|
|
|
*/ |
|
104
|
|
|
private $gsm; |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* Set address |
|
108
|
|
|
* |
|
109
|
|
|
* @param string $address |
|
110
|
|
|
* @return Contact |
|
111
|
|
|
*/ |
|
112
|
|
|
public function setAddress($address) |
|
113
|
|
|
{ |
|
114
|
|
|
$this->address = $address; |
|
115
|
|
|
|
|
116
|
|
|
return $this; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* Get address |
|
121
|
|
|
* |
|
122
|
|
|
* @return string |
|
123
|
|
|
*/ |
|
124
|
|
|
public function getAddress() |
|
125
|
|
|
{ |
|
126
|
|
|
return $this->address; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* Set zipcode |
|
131
|
|
|
* |
|
132
|
|
|
* @param string $zipcode |
|
133
|
|
|
* @return Contact |
|
134
|
|
|
*/ |
|
135
|
|
|
public function setZipcode($zipcode) |
|
136
|
|
|
{ |
|
137
|
|
|
$this->zipcode = $zipcode; |
|
138
|
|
|
|
|
139
|
|
|
return $this; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* Get zipcode |
|
144
|
|
|
* |
|
145
|
|
|
* @return string |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getZipcode() |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->zipcode; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* Set town |
|
154
|
|
|
* |
|
155
|
|
|
* @param string $town |
|
156
|
|
|
* @return Contact |
|
157
|
|
|
*/ |
|
158
|
|
|
public function setTown($town) |
|
159
|
|
|
{ |
|
160
|
|
|
$this->town = $town; |
|
161
|
|
|
|
|
162
|
|
|
return $this; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* Get town |
|
167
|
|
|
* |
|
168
|
|
|
* @return string |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getTown() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->town; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Set phone |
|
177
|
|
|
* |
|
178
|
|
|
* @param phone_number $phone |
|
179
|
|
|
* @return Contact |
|
180
|
|
|
*/ |
|
181
|
|
|
public function setPhone($phone) |
|
182
|
|
|
{ |
|
183
|
|
|
$this->phone = $phone; |
|
184
|
|
|
|
|
185
|
|
|
return $this; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* Get phone |
|
190
|
|
|
* |
|
191
|
|
|
* @return phone_number |
|
192
|
|
|
*/ |
|
193
|
|
|
public function getPhone() |
|
194
|
|
|
{ |
|
195
|
|
|
return $this->phone; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* Set fax |
|
200
|
|
|
* |
|
201
|
|
|
* @param phone_number $fax |
|
202
|
|
|
* @return Contact |
|
203
|
|
|
*/ |
|
204
|
|
|
public function setFax($fax) |
|
205
|
|
|
{ |
|
206
|
|
|
$this->fax = $fax; |
|
207
|
|
|
|
|
208
|
|
|
return $this; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* Get fax |
|
213
|
|
|
* |
|
214
|
|
|
* @return phone_number |
|
215
|
|
|
*/ |
|
216
|
|
|
public function getFax() |
|
217
|
|
|
{ |
|
218
|
|
|
return $this->fax; |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
/** |
|
222
|
|
|
* Set email |
|
223
|
|
|
* |
|
224
|
|
|
* @param string $email |
|
225
|
|
|
* @return Contact |
|
226
|
|
|
*/ |
|
227
|
|
|
public function setEmail($email) |
|
228
|
|
|
{ |
|
229
|
|
|
$this->email = $email; |
|
230
|
|
|
|
|
231
|
|
|
return $this; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* Get email |
|
236
|
|
|
* |
|
237
|
|
|
* @return string |
|
238
|
|
|
*/ |
|
239
|
|
|
public function getEmail() |
|
240
|
|
|
{ |
|
241
|
|
|
return $this->email; |
|
242
|
|
|
} |
|
243
|
|
|
|
|
244
|
|
|
/** |
|
245
|
|
|
* Set contact |
|
246
|
|
|
* |
|
247
|
|
|
* @param string $contact |
|
248
|
|
|
* @return Contact |
|
249
|
|
|
*/ |
|
250
|
|
|
public function setContact($contact) |
|
251
|
|
|
{ |
|
252
|
|
|
$this->contact = $contact; |
|
253
|
|
|
|
|
254
|
|
|
return $this; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* Get contact |
|
259
|
|
|
* |
|
260
|
|
|
* @return string |
|
261
|
|
|
*/ |
|
262
|
|
|
public function getContact() |
|
263
|
|
|
{ |
|
264
|
|
|
return $this->contact; |
|
265
|
|
|
} |
|
266
|
|
|
|
|
267
|
|
|
/** |
|
268
|
|
|
* Set gsm |
|
269
|
|
|
* |
|
270
|
|
|
* @param phone_number $gsm |
|
271
|
|
|
* |
|
272
|
|
|
* @return Contact |
|
273
|
|
|
*/ |
|
274
|
|
|
public function setGsm($gsm) |
|
275
|
|
|
{ |
|
276
|
|
|
$this->gsm = $gsm; |
|
277
|
|
|
|
|
278
|
|
|
return $this; |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
/** |
|
282
|
|
|
* Get gsm |
|
283
|
|
|
* |
|
284
|
|
|
* @return phone_number |
|
285
|
|
|
*/ |
|
286
|
|
|
public function getGsm() |
|
287
|
|
|
{ |
|
288
|
|
|
return $this->gsm; |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* Set name |
|
293
|
|
|
* |
|
294
|
|
|
* @param string $name |
|
295
|
|
|
* |
|
296
|
|
|
* @return Contact |
|
297
|
|
|
*/ |
|
298
|
|
|
public function setName($name) |
|
299
|
|
|
{ |
|
300
|
|
|
$this->name = $name; |
|
301
|
|
|
|
|
302
|
|
|
return $this; |
|
303
|
|
|
} |
|
304
|
|
|
|
|
305
|
|
|
/** |
|
306
|
|
|
* Get name |
|
307
|
|
|
* |
|
308
|
|
|
* @return string |
|
309
|
|
|
*/ |
|
310
|
|
|
public function getName() |
|
311
|
|
|
{ |
|
312
|
|
|
return $this->name; |
|
313
|
|
|
} |
|
314
|
|
|
|
|
315
|
|
|
/** |
|
316
|
|
|
* Get complete address |
|
317
|
|
|
* |
|
318
|
|
|
* @return string |
|
319
|
|
|
*/ |
|
320
|
|
|
public function getCompleteAddress() |
|
321
|
|
|
{ |
|
322
|
|
|
return $this->address . "<br>" . $this->zipcode . ' ' . $this->town; |
|
|
|
|
|
|
323
|
|
|
} |
|
324
|
|
|
} |
|
325
|
|
|
|
PHP provides two ways to mark string literals. Either with single quotes
'literal'or with double quotes"literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (
\') and the backslash (\\). Every other character is displayed as is.Double quoted string literals may contain other variables or more complex escape sequences.
will print an indented:
Single is ValueIf your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.
For more information on PHP string literals and available escape sequences see the PHP core documentation.