1 | <?php |
||
19 | class PostVotePostElement implements InputFilterAwareInterface, Translatable, \JsonSerializable |
||
20 | { |
||
21 | /** |
||
22 | * @Gedmo\Locale |
||
23 | * Used locale to override Translation listener`s locale |
||
24 | * this is not a mapped field of entity metadata, just a simple property |
||
25 | */ |
||
26 | protected $locale; |
||
27 | |||
28 | protected $inputFilter; |
||
29 | |||
30 | /** |
||
31 | * @ORM\Id |
||
32 | * @ORM\Column(type="integer"); |
||
33 | * @ORM\GeneratedValue(strategy="AUTO") |
||
34 | */ |
||
35 | protected $id; |
||
36 | |||
37 | /** |
||
38 | * @ORM\ManyToOne(targetEntity="PostVotePost", inversedBy="postElements") |
||
39 | * @ORM\JoinColumn(name="post_id", referencedColumnName="id", onDelete="CASCADE") |
||
40 | * |
||
41 | **/ |
||
42 | protected $post; |
||
43 | |||
44 | /** |
||
45 | * @ORM\Column(type="string", nullable=true) |
||
46 | */ |
||
47 | protected $name; |
||
48 | |||
49 | /** |
||
50 | * @Gedmo\Translatable |
||
51 | * @ORM\Column(type="text", nullable=true) |
||
52 | */ |
||
53 | protected $value; |
||
54 | |||
55 | /** |
||
56 | * @ORM\Column(type="string", nullable=true) |
||
57 | */ |
||
58 | protected $position; |
||
59 | |||
60 | /** |
||
61 | * @ORM\Column(name="created_at", type="datetime") |
||
62 | */ |
||
63 | protected $createdAt; |
||
64 | |||
65 | /** |
||
66 | * @ORM\Column(name="updated_at", type="datetime") |
||
67 | */ |
||
68 | protected $updatedAt; |
||
69 | |||
70 | public function __construct() |
||
73 | |||
74 | /** @PrePersist */ |
||
75 | public function createChrono() |
||
80 | |||
81 | /** @PreUpdate */ |
||
82 | public function updateChrono() |
||
86 | |||
87 | /** |
||
88 | * @return the unknown_type |
||
89 | */ |
||
90 | public function getId() |
||
94 | |||
95 | /** |
||
96 | * @param unknown_type $id |
||
97 | */ |
||
98 | public function setId($id) |
||
104 | |||
105 | /** |
||
106 | * @return the unknown_type |
||
107 | */ |
||
108 | public function getPost() |
||
112 | |||
113 | /** |
||
114 | * @param unknown_type $post |
||
115 | */ |
||
116 | public function setPost($post) |
||
122 | |||
123 | /** |
||
124 | * @return the unknown_type |
||
125 | */ |
||
126 | public function getValue() |
||
130 | |||
131 | /** |
||
132 | * @param unknown_type $value |
||
133 | */ |
||
134 | public function setValue($value) |
||
140 | |||
141 | /** |
||
142 | * @return the unknown_type |
||
143 | */ |
||
144 | public function getName() |
||
148 | |||
149 | /** |
||
150 | * @param unknown_type $name |
||
151 | */ |
||
152 | public function setName($name) |
||
158 | |||
159 | /** |
||
160 | * @return the unknown_type |
||
161 | */ |
||
162 | public function getPosition() |
||
166 | |||
167 | /** |
||
168 | * @param unknown_type $position |
||
169 | */ |
||
170 | public function setPosition($position) |
||
176 | |||
177 | /** |
||
178 | * @return the unknown_type |
||
179 | */ |
||
180 | public function getCreatedAt() |
||
184 | |||
185 | /** |
||
186 | * @param unknown_type $createdAt |
||
187 | */ |
||
188 | public function setCreatedAt($createdAt) |
||
194 | |||
195 | /** |
||
196 | * @return the unknown_type |
||
197 | */ |
||
198 | public function getUpdatedAt() |
||
202 | |||
203 | /** |
||
204 | * @param unknown_type $updatedAt |
||
205 | */ |
||
206 | public function setUpdatedAt($updatedAt) |
||
212 | |||
213 | /** |
||
214 | * Convert the object to an array. |
||
215 | * |
||
216 | * @return array |
||
217 | */ |
||
218 | public function getArrayCopy() |
||
219 | { |
||
220 | $obj_vars = get_object_vars($this); |
||
221 | // if called from getArrayCopy of PostVotePost, |
||
222 | // keeping the post object in each element produce an infinite loop... |
||
223 | if (isset($obj_vars['post'])) { |
||
224 | $obj_vars['post'] = null; |
||
225 | } |
||
226 | |||
227 | return $obj_vars; |
||
228 | } |
||
229 | |||
230 | /** |
||
231 | * Convert the object to json. |
||
232 | * |
||
233 | * @return array |
||
234 | */ |
||
235 | public function jsonSerialize() |
||
236 | { |
||
237 | return $this->getArrayCopy(); |
||
238 | } |
||
239 | |||
240 | /** |
||
241 | * Populate from an array. |
||
242 | * |
||
243 | * @param array $data |
||
244 | */ |
||
245 | public function populate($data = array()) |
||
248 | |||
249 | public function setInputFilter(InputFilterInterface $inputFilter) |
||
253 | |||
254 | public function getInputFilter() |
||
264 | |||
265 | public function setTranslatableLocale($locale) |
||
269 | } |
||
270 |