1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Model; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
6
|
|
|
use JMS\Serializer\Annotation\Accessor; |
7
|
|
|
use JMS\Serializer\Annotation\ExclusionPolicy; |
8
|
|
|
use JMS\Serializer\Annotation\Expose; |
9
|
|
|
use JMS\Serializer\Annotation\Type; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @ExclusionPolicy("all") |
13
|
|
|
*/ |
14
|
|
|
class CustomerRequest |
15
|
|
|
{ |
16
|
|
|
const SOCIAL_NETWORK_FACEBOOK = 'facebook'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var string |
20
|
|
|
* @Type("string") |
21
|
|
|
* @Accessor(getter="getFirstName") |
22
|
|
|
* @Assert\Regex(pattern="/\d/", match=false, groups={"update"}) |
23
|
|
|
* @Assert\Type("string", groups={"update"}) |
24
|
|
|
* @Assert\Length(min=2, max=100, groups={"update"}) |
25
|
|
|
* @Assert\NotBlank( |
26
|
|
|
* message="not.blank", groups={"update"} |
27
|
|
|
* ) |
28
|
|
|
* @Expose |
29
|
|
|
*/ |
30
|
|
|
protected $firstName; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string |
34
|
|
|
* @Type("string") |
35
|
|
|
* @Accessor(getter="getLastName") |
36
|
|
|
* @Assert\Regex(pattern="/\d/", match=false, groups={"update"}) |
37
|
|
|
* @Assert\Type("string", groups={"update"}) |
38
|
|
|
* @Assert\Length(min=2, max=100, groups={"update"}) |
39
|
|
|
* @Assert\NotBlank( |
40
|
|
|
* message="not.blank", groups={"update"} |
41
|
|
|
* ) |
42
|
|
|
* @Expose |
43
|
|
|
*/ |
44
|
|
|
protected $lastName; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var string |
48
|
|
|
* @Type("string") |
49
|
|
|
* @Accessor(getter="getEmail") |
50
|
|
|
* @Assert\Email(groups={"update"}) |
51
|
|
|
* @Assert\Type("string", groups={"update"}) |
52
|
|
|
* @Assert\Length(max=100, groups={"update"}) |
53
|
|
|
* @Assert\NotBlank( |
54
|
|
|
* message="not.blank", groups={"update"} |
55
|
|
|
* ) |
56
|
|
|
* @Expose |
57
|
|
|
*/ |
58
|
|
|
protected $email; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var string |
62
|
|
|
* |
63
|
|
|
* @Type("string") |
64
|
|
|
* @Accessor(getter="getApiKey") |
65
|
|
|
* @Expose |
66
|
|
|
*/ |
67
|
|
|
protected $apiKey; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var string |
71
|
|
|
* |
72
|
|
|
* @Type("string") |
73
|
|
|
* @Accessor(getter="getSocialNetwork") |
74
|
|
|
* @Assert\NotBlank(groups={"socialNetwork"}) |
75
|
|
|
* @Assert\Choice(callback="getSocialNetworks", groups={"socialNetwork"}) |
76
|
|
|
* @Expose |
77
|
|
|
*/ |
78
|
|
|
protected $socialNetwork; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @var string |
82
|
|
|
* |
83
|
|
|
* @Type("string") |
84
|
|
|
* @Accessor(getter="getSocialToken") |
85
|
|
|
* @Assert\NotBlank(groups={"socialNetwork"}) |
86
|
|
|
* @Expose |
87
|
|
|
*/ |
88
|
|
|
protected $socialToken; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Get firstName. |
92
|
|
|
* |
93
|
|
|
* @return string |
94
|
|
|
*/ |
95
|
|
|
public function getFirstName() |
96
|
|
|
{ |
97
|
|
|
return $this->firstName; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Get lastName. |
102
|
|
|
* |
103
|
|
|
* @return string |
104
|
|
|
*/ |
105
|
|
|
public function getLastName() |
106
|
|
|
{ |
107
|
|
|
return $this->lastName; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Get email. |
112
|
|
|
* |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
|
|
public function getEmail() |
116
|
|
|
{ |
117
|
|
|
return $this->email; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return string |
122
|
|
|
*/ |
123
|
|
|
public function getSocialNetwork() |
124
|
|
|
{ |
125
|
|
|
return $this->socialNetwork; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return array |
130
|
|
|
*/ |
131
|
|
|
public static function getSocialNetworks() |
132
|
|
|
{ |
133
|
|
|
return [ |
134
|
|
|
self::SOCIAL_NETWORK_FACEBOOK, |
135
|
|
|
]; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return string |
140
|
|
|
*/ |
141
|
|
|
public function getSocialToken() |
142
|
|
|
{ |
143
|
|
|
return $this->socialToken; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Set apiKey. |
148
|
|
|
* |
149
|
|
|
* @param string $apiKey |
150
|
|
|
* |
151
|
|
|
* @return mixed |
152
|
|
|
*/ |
153
|
|
|
public function setApiKey($apiKey) |
154
|
|
|
{ |
155
|
|
|
$this->apiKey = $apiKey; |
156
|
|
|
|
157
|
|
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return string |
162
|
|
|
*/ |
163
|
|
|
public function getApiKey() |
164
|
|
|
{ |
165
|
|
|
return $this->apiKey; |
166
|
|
|
} |
167
|
|
|
} |
168
|
|
|
|