|
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 JsonSerializable; |
|
15
|
|
|
use ONGR\ElasticsearchBundle\Annotation as ES; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Stores admin settings. |
|
19
|
|
|
* |
|
20
|
|
|
* @ES\Document(type="setting") |
|
21
|
|
|
*/ |
|
22
|
|
|
class Setting implements JsonSerializable |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
* |
|
27
|
|
|
* @ES\Id() |
|
28
|
|
|
*/ |
|
29
|
|
|
private $id; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @const TYPE_STRING setting model of string type |
|
33
|
|
|
*/ |
|
34
|
|
|
const TYPE_STRING = 'string'; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @const TYPE_ARRAY setting model of array type |
|
38
|
|
|
*/ |
|
39
|
|
|
const TYPE_ARRAY = 'array'; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @const TYPE_BOOLEAN setting model of boolean type |
|
43
|
|
|
*/ |
|
44
|
|
|
const TYPE_BOOLEAN = 'bool'; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @const TYPE_OBJECT setting model of object type |
|
48
|
|
|
*/ |
|
49
|
|
|
const TYPE_OBJECT = 'object'; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var string |
|
53
|
|
|
* |
|
54
|
|
|
* @ES\Property(name="name", type="string", options={"analyzer"="standard"}) |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $name; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var string |
|
60
|
|
|
* |
|
61
|
|
|
* @ES\Property(name="description", type="string", options={"analyzer"="standard"}) |
|
62
|
|
|
*/ |
|
63
|
|
|
protected $description; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @var string |
|
67
|
|
|
* |
|
68
|
|
|
* @ES\Property(name="profile", type="string", options={"analyzer"="standard"}) |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $profile; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @var string |
|
74
|
|
|
* |
|
75
|
|
|
* @ES\Property(name="type", type="string", options={"analyzer"="standard"}) |
|
76
|
|
|
*/ |
|
77
|
|
|
protected $type; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @var string |
|
81
|
|
|
* |
|
82
|
|
|
* @ES\Property(name="data", type="string", options={"analyzer"="standard"}) |
|
83
|
|
|
*/ |
|
84
|
|
|
protected $data; |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @return string |
|
88
|
|
|
*/ |
|
89
|
|
|
public function getId() |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->id; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @param string $id |
|
96
|
|
|
*/ |
|
97
|
|
|
public function setId($id) |
|
98
|
|
|
{ |
|
99
|
|
|
$this->id = $id; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Get data. |
|
104
|
|
|
* |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getData() |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->data; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Set data. |
|
114
|
|
|
* |
|
115
|
|
|
* @param string $data |
|
116
|
|
|
*/ |
|
117
|
|
|
public function setData($data) |
|
118
|
|
|
{ |
|
119
|
|
|
$this->data = $data; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* Get type. |
|
124
|
|
|
* |
|
125
|
|
|
* @return string |
|
126
|
|
|
*/ |
|
127
|
|
|
public function getType() |
|
128
|
|
|
{ |
|
129
|
|
|
return $this->type; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* Set type. |
|
134
|
|
|
* |
|
135
|
|
|
* @param string $type |
|
136
|
|
|
*/ |
|
137
|
|
|
public function setType($type) |
|
138
|
|
|
{ |
|
139
|
|
|
$this->type = $type; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* Get profile. |
|
144
|
|
|
* |
|
145
|
|
|
* @return string |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getProfile() |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->profile; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* Set profile. |
|
154
|
|
|
* |
|
155
|
|
|
* @param string $profile |
|
156
|
|
|
*/ |
|
157
|
|
|
public function setProfile($profile) |
|
158
|
|
|
{ |
|
159
|
|
|
$this->profile = $profile; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* Get description. |
|
164
|
|
|
* |
|
165
|
|
|
* @return string |
|
166
|
|
|
*/ |
|
167
|
|
|
public function getDescription() |
|
168
|
|
|
{ |
|
169
|
|
|
return $this->description; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* Set description. |
|
174
|
|
|
* |
|
175
|
|
|
* @param string $description |
|
176
|
|
|
*/ |
|
177
|
|
|
public function setDescription($description) |
|
178
|
|
|
{ |
|
179
|
|
|
$this->description = $description; |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* Get name. |
|
184
|
|
|
* |
|
185
|
|
|
* @return string |
|
186
|
|
|
*/ |
|
187
|
|
|
public function getName() |
|
188
|
|
|
{ |
|
189
|
|
|
return $this->name; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* Set name. |
|
194
|
|
|
* |
|
195
|
|
|
* @param string $name |
|
196
|
|
|
*/ |
|
197
|
|
|
public function setName($name) |
|
198
|
|
|
{ |
|
199
|
|
|
$this->name = $name; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* Specify data which should be serialized to JSON. |
|
204
|
|
|
* |
|
205
|
|
|
* @return mixed Data which can be serialized by json_encode. |
|
206
|
|
|
*/ |
|
207
|
|
|
public function jsonSerialize() |
|
208
|
|
|
{ |
|
209
|
|
|
return [ |
|
210
|
|
|
'name' => $this->getName(), |
|
211
|
|
|
'description' => $this->getDescription(), |
|
212
|
|
|
'profile' => $this->getProfile(), |
|
213
|
|
|
'type' => $this->getType(), |
|
214
|
|
|
'data' => $this->getData(), |
|
215
|
|
|
'id' => $this->getId() |
|
216
|
|
|
]; |
|
217
|
|
|
} |
|
218
|
|
|
} |
|
219
|
|
|
|