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 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="string", options={"index"="not_analyzed"}) |
34
|
|
|
*/ |
35
|
|
|
private $translation; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
* |
40
|
|
|
* @ES\Property(type="string", options={"index"="not_analyzed"}) |
41
|
|
|
*/ |
42
|
|
|
private $locale; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string |
46
|
|
|
* |
47
|
|
|
* @ES\Property(type="string") |
48
|
|
|
*/ |
49
|
|
|
private $message; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var \DateTime |
53
|
|
|
* |
54
|
|
|
* @ES\Property(type="date") |
55
|
|
|
*/ |
56
|
|
|
private $updatedAt; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Sets document ID. |
60
|
|
|
* |
61
|
|
|
* @param string $id |
62
|
|
|
* |
63
|
|
|
* @return $this |
64
|
|
|
*/ |
65
|
|
|
public function setId($id) |
66
|
|
|
{ |
67
|
|
|
$this->id = $id; |
68
|
|
|
|
69
|
|
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Returns document ID. |
74
|
|
|
* |
75
|
|
|
* @return string |
76
|
|
|
*/ |
77
|
|
|
public function getId() |
78
|
|
|
{ |
79
|
|
|
return $this->id; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param string $translation |
84
|
|
|
* |
85
|
|
|
* @return History |
86
|
|
|
*/ |
87
|
|
|
public function setTranslation($translation) |
88
|
|
|
{ |
89
|
|
|
$this->translation = $translation; |
90
|
|
|
|
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return string |
96
|
|
|
*/ |
97
|
|
|
public function getTranslation() |
98
|
|
|
{ |
99
|
|
|
return $this->translation; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param string $locale |
104
|
|
|
* |
105
|
|
|
* @return History |
106
|
|
|
*/ |
107
|
|
|
public function setLocale($locale) |
108
|
|
|
{ |
109
|
|
|
$this->locale = $locale; |
110
|
|
|
|
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return string |
116
|
|
|
*/ |
117
|
|
|
public function getLocale() |
118
|
|
|
{ |
119
|
|
|
return $this->locale; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @param string $message |
124
|
|
|
* |
125
|
|
|
* @return History |
126
|
|
|
*/ |
127
|
|
|
public function setMessage($message) |
128
|
|
|
{ |
129
|
|
|
$this->message = $message; |
130
|
|
|
|
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return string |
136
|
|
|
*/ |
137
|
|
|
public function getMessage() |
138
|
|
|
{ |
139
|
|
|
return $this->message; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @return \DateTime |
144
|
|
|
*/ |
145
|
|
|
public function getUpdatedAt() |
146
|
|
|
{ |
147
|
|
|
return $this->updatedAt; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @param \DateTime $updatedAt |
152
|
|
|
*/ |
153
|
|
|
public function setUpdatedAt($updatedAt) |
154
|
|
|
{ |
155
|
|
|
$this->updatedAt = $updatedAt; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* {@inheritdoc} |
160
|
|
|
*/ |
161
|
|
|
public function jsonSerialize() |
162
|
|
|
{ |
163
|
|
|
return [ |
164
|
|
|
'id' => $this->getId(), |
165
|
|
|
'message' => $this->getMessage(), |
166
|
|
|
'translation' => $this->getTranslation(), |
167
|
|
|
'locale' => $this->getLocale(), |
168
|
|
|
'updatedAt' => $this->getUpdatedAt()->format('Y-m-d H:i:s'), |
169
|
|
|
]; |
170
|
|
|
} |
171
|
|
|
} |
172
|
|
|
|