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\TranslationsBundle\Document; |
13
|
|
|
|
14
|
|
|
use ONGR\ElasticsearchBundle\Annotation as ES; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Holds translations history. |
18
|
|
|
* |
19
|
|
|
* @ES\Document(type="history") |
20
|
|
|
*/ |
21
|
|
|
class History extends Translation implements \JsonSerializable |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
* |
26
|
|
|
* @ES\Id() |
27
|
|
|
*/ |
28
|
|
|
private $id; |
|
|
|
|
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string |
32
|
|
|
* |
33
|
|
|
* @ES\Property(type="keyword") |
34
|
|
|
*/ |
35
|
|
|
private $key; |
|
|
|
|
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
* |
40
|
|
|
* @ES\Property(type="keyword") |
41
|
|
|
*/ |
42
|
|
|
private $locale; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string |
46
|
|
|
* |
47
|
|
|
* @ES\Property(type="text") |
48
|
|
|
*/ |
49
|
|
|
private $message; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var string |
53
|
|
|
* |
54
|
|
|
* @ES\Property(type="keyword") |
55
|
|
|
*/ |
56
|
|
|
private $domain; |
|
|
|
|
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var \DateTime |
60
|
|
|
* |
61
|
|
|
* @ES\Property(type="date") |
62
|
|
|
*/ |
63
|
|
|
private $updatedAt; |
|
|
|
|
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Sets document ID. |
67
|
|
|
* |
68
|
|
|
* @param string $id |
69
|
|
|
* |
70
|
|
|
* @return $this |
71
|
|
|
*/ |
72
|
|
|
public function setId($id) |
73
|
|
|
{ |
74
|
|
|
$this->id = $id; |
75
|
|
|
|
76
|
|
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Returns document ID. |
81
|
|
|
* |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
|
|
public function getId() |
85
|
|
|
{ |
86
|
|
|
return $this->id; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @param string $key |
91
|
|
|
* |
92
|
|
|
* @return History |
93
|
|
|
*/ |
94
|
|
|
public function setKey($key) |
95
|
|
|
{ |
96
|
|
|
$this->key = $key; |
97
|
|
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
|
|
public function getKey() |
104
|
|
|
{ |
105
|
|
|
return $this->key; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @param string $locale |
110
|
|
|
* |
111
|
|
|
* @return History |
112
|
|
|
*/ |
113
|
|
|
public function setLocale($locale) |
114
|
|
|
{ |
115
|
|
|
$this->locale = $locale; |
116
|
|
|
|
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return string |
122
|
|
|
*/ |
123
|
|
|
public function getLocale() |
124
|
|
|
{ |
125
|
|
|
return $this->locale; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param string $message |
130
|
|
|
* |
131
|
|
|
* @return History |
132
|
|
|
*/ |
133
|
|
|
public function setMessage($message) |
134
|
|
|
{ |
135
|
|
|
$this->message = $message; |
136
|
|
|
|
137
|
|
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @return string |
142
|
|
|
*/ |
143
|
|
|
public function getMessage() |
144
|
|
|
{ |
145
|
|
|
return $this->message; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @param string $domain |
150
|
|
|
* |
151
|
|
|
* @return History |
152
|
|
|
*/ |
153
|
|
|
public function setDomain($domain) |
154
|
|
|
{ |
155
|
|
|
$this->domain = $domain; |
156
|
|
|
return $this; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @return string |
161
|
|
|
*/ |
162
|
|
|
public function getDomain() |
163
|
|
|
{ |
164
|
|
|
return $this->domain; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @return \DateTime |
169
|
|
|
*/ |
170
|
|
|
public function getUpdatedAt() |
171
|
|
|
{ |
172
|
|
|
return $this->updatedAt; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @param \DateTime $updatedAt |
177
|
|
|
*/ |
178
|
|
|
public function setUpdatedAt($updatedAt) |
179
|
|
|
{ |
180
|
|
|
$this->updatedAt = $updatedAt; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* {@inheritdoc} |
185
|
|
|
*/ |
186
|
|
|
public function jsonSerialize() |
187
|
|
|
{ |
188
|
|
|
return [ |
189
|
|
|
'id' => $this->getId(), |
190
|
|
|
'message' => $this->getMessage(), |
191
|
|
|
'key' => $this->getKey(), |
192
|
|
|
'domain' => $this->getDomain(), |
193
|
|
|
'locale' => $this->getLocale(), |
194
|
|
|
'updatedAt' => $this->getUpdatedAt()->format('Y-m-d H:i:s'), |
195
|
|
|
]; |
196
|
|
|
} |
197
|
|
|
} |
198
|
|
|
|