1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the ONGR package. |
5
|
|
|
* |
6
|
|
|
* (c) NFQ Technologies UAB <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace ONGR\SettingsBundle\Document; |
13
|
|
|
|
14
|
|
|
use ONGR\ElasticsearchBundle\Annotation as ES; |
15
|
|
|
use ONGR\FilterManagerBundle\SerializableInterface; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Stores admin settings. |
19
|
|
|
* |
20
|
|
|
* @ES\Document(type="setting") |
21
|
|
|
*/ |
22
|
|
|
class Setting implements SerializableInterface |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
* |
27
|
|
|
* @ES\Id() |
28
|
|
|
*/ |
29
|
|
|
private $id; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
* |
34
|
|
|
* @ES\Property( |
35
|
|
|
* type="keyword", |
36
|
|
|
* options={ |
37
|
|
|
* "fields"={ |
38
|
|
|
* "raw"={"type"="keyword", "index"="not_analyzed"}, |
39
|
|
|
* "name"={"type"="keyword"} |
40
|
|
|
* } |
41
|
|
|
* } |
42
|
|
|
* ) |
43
|
|
|
*/ |
44
|
|
|
private $name; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var string |
48
|
|
|
* |
49
|
|
|
* @ES\Property(type="text", options={"analyzer"="standard"}) |
50
|
|
|
*/ |
51
|
|
|
private $description; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string |
55
|
|
|
* |
56
|
|
|
* @ES\Property( |
57
|
|
|
* type="keyword", |
58
|
|
|
* options={ |
59
|
|
|
* "fields"={ |
60
|
|
|
* "raw"={"type"="keyword", "index"="not_analyzed"}, |
61
|
|
|
* "profile"={"type"="keyword"} |
62
|
|
|
* } |
63
|
|
|
* } |
64
|
|
|
* ) |
65
|
|
|
*/ |
66
|
|
|
private $profile = []; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @var string |
70
|
|
|
* |
71
|
|
|
* @ES\Property(type="keyword", options={"index"="not_analyzed"}) |
72
|
|
|
*/ |
73
|
|
|
private $type; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @var string |
77
|
|
|
* |
78
|
|
|
* @ES\Property(type="keyword", options={"index"="not_analyzed"}) |
79
|
|
|
*/ |
80
|
|
|
private $value; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @var string |
84
|
|
|
* |
85
|
|
|
* @ES\Property(type="keyword", options={"index"="not_analyzed"}) |
86
|
|
|
*/ |
87
|
|
|
private $salt; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @var string |
91
|
|
|
* |
92
|
|
|
* @ES\Property(type="date") |
93
|
|
|
*/ |
94
|
|
|
private $createdAt; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Setting constructor. |
98
|
|
|
*/ |
99
|
|
|
public function __construct() |
100
|
|
|
{ |
101
|
|
|
$this->createdAt = new \DateTime(); |
|
|
|
|
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return string |
106
|
|
|
*/ |
107
|
|
|
public function getId() |
108
|
|
|
{ |
109
|
|
|
return $this->id; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @param string $id |
114
|
|
|
*/ |
115
|
|
|
public function setId($id) |
116
|
|
|
{ |
117
|
|
|
$this->id = $id; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return string |
122
|
|
|
*/ |
123
|
|
|
public function getValue() |
124
|
|
|
{ |
125
|
|
|
return $this->value; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param string $value |
130
|
|
|
*/ |
131
|
|
|
public function setValue($value) |
132
|
|
|
{ |
133
|
|
|
$this->value = $value; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Get type. |
138
|
|
|
* |
139
|
|
|
* @return string |
140
|
|
|
*/ |
141
|
|
|
public function getType() |
142
|
|
|
{ |
143
|
|
|
return $this->type; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Set type. |
148
|
|
|
* |
149
|
|
|
* @param string $type |
150
|
|
|
*/ |
151
|
|
|
public function setType($type) |
152
|
|
|
{ |
153
|
|
|
$this->type = $type; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Get profile. |
158
|
|
|
* |
159
|
|
|
* @return string|array |
160
|
|
|
*/ |
161
|
|
|
public function getProfile() |
162
|
|
|
{ |
163
|
|
|
return $this->profile; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Set profile. |
168
|
|
|
* |
169
|
|
|
* @param string|array $profile |
170
|
|
|
*/ |
171
|
|
|
public function setProfile($profile) |
172
|
|
|
{ |
173
|
|
|
$this->profile = $profile; |
|
|
|
|
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Get description. |
178
|
|
|
* |
179
|
|
|
* @return string |
180
|
|
|
*/ |
181
|
|
|
public function getDescription() |
182
|
|
|
{ |
183
|
|
|
return $this->description; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Set description. |
188
|
|
|
* |
189
|
|
|
* @param string $description |
190
|
|
|
*/ |
191
|
|
|
public function setDescription($description) |
192
|
|
|
{ |
193
|
|
|
$this->description = $description; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Get name. |
198
|
|
|
* |
199
|
|
|
* @return string |
200
|
|
|
*/ |
201
|
|
|
public function getName() |
202
|
|
|
{ |
203
|
|
|
return $this->name; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* Set name. |
208
|
|
|
* |
209
|
|
|
* @param string $name |
210
|
|
|
*/ |
211
|
|
|
public function setName($name) |
212
|
|
|
{ |
213
|
|
|
$this->name = $name; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* @return string |
218
|
|
|
*/ |
219
|
|
|
public function getSalt() |
220
|
|
|
{ |
221
|
|
|
return $this->salt; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* @param string $salt |
226
|
|
|
*/ |
227
|
|
|
public function setSalt($salt) |
228
|
|
|
{ |
229
|
|
|
$this->salt = $salt; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* @return string |
234
|
|
|
*/ |
235
|
|
|
public function getCreatedAt() |
236
|
|
|
{ |
237
|
|
|
return $this->createdAt; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @param string $createdAt |
242
|
|
|
*/ |
243
|
|
|
public function setCreatedAt($createdAt) |
244
|
|
|
{ |
245
|
|
|
$this->createdAt = $createdAt; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* Specify data which should be serialized to JSON. |
250
|
|
|
* |
251
|
|
|
* @return mixed Data which can be serialized by json_encode. |
252
|
|
|
*/ |
253
|
|
|
public function getSerializableData() |
254
|
|
|
{ |
255
|
|
|
return [ |
256
|
|
|
'id' => $this->getId(), |
257
|
|
|
'name' => $this->getName(), |
258
|
|
|
'description' => $this->getDescription(), |
259
|
|
|
'profile' => $this->getProfile(), |
260
|
|
|
'salt' => $this->getSalt(), |
261
|
|
|
'type' => $this->getType(), |
262
|
|
|
'value' => $this->getValue(), |
263
|
|
|
]; |
264
|
|
|
} |
265
|
|
|
} |
266
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..