]>
Commit | Line | Data |
---|---|---|
9d50517c NL |
1 | <?php |
2 | ||
ad4d1caa | 3 | namespace Wallabag\CoreBundle\Entity; |
9d50517c NL |
4 | |
5 | use Doctrine\ORM\Mapping as ORM; | |
b84a8055 | 6 | use Symfony\Component\Validator\Constraints as Assert; |
9d50517c NL |
7 | |
8 | /** | |
9 | * Entries | |
10 | * | |
ad4d1caa | 11 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntriesRepository") |
9d50517c | 12 | * @ORM\Table(name="entries") |
34d15eb4 | 13 | * @ORM\HasLifecycleCallbacks() |
c3235553 | 14 | * |
9d50517c NL |
15 | */ |
16 | class Entries | |
17 | { | |
18 | /** | |
19 | * @var integer | |
20 | * | |
21 | * @ORM\Column(name="id", type="integer", nullable=true) | |
22 | * @ORM\Id | |
34d15eb4 | 23 | * @ORM\GeneratedValue(strategy="AUTO") |
9d50517c | 24 | */ |
34d15eb4 | 25 | private $id = null; |
9d50517c NL |
26 | |
27 | /** | |
28 | * @var string | |
29 | * | |
30 | * @ORM\Column(name="title", type="text", nullable=true) | |
31 | */ | |
32 | private $title; | |
33 | ||
34 | /** | |
35 | * @var string | |
36 | * | |
b84a8055 | 37 | * @Assert\NotBlank() |
9d50517c NL |
38 | * @ORM\Column(name="url", type="text", nullable=true) |
39 | */ | |
40 | private $url; | |
41 | ||
42 | /** | |
eacaf7f8 | 43 | * @var boolean |
9d50517c | 44 | * |
34d15eb4 | 45 | * @ORM\Column(name="is_read", type="boolean", nullable=true, options={"default" = false}) |
9d50517c | 46 | */ |
34d15eb4 | 47 | private $isRead = false; |
9d50517c NL |
48 | |
49 | /** | |
eacaf7f8 | 50 | * @var boolean |
9d50517c | 51 | * |
34d15eb4 | 52 | * @ORM\Column(name="is_fav", type="boolean", nullable=true, options={"default" = false}) |
9d50517c | 53 | */ |
34d15eb4 | 54 | private $isFav = false; |
9d50517c NL |
55 | |
56 | /** | |
eacaf7f8 | 57 | * @var boolean |
9d50517c | 58 | * |
34d15eb4 | 59 | * @ORM\Column(name="is_deleted", type="boolean", nullable=true, options={"default" = false}) |
9d50517c | 60 | */ |
34d15eb4 | 61 | private $isDeleted = false; |
9d50517c NL |
62 | |
63 | /** | |
64 | * @var string | |
65 | * | |
eacaf7f8 | 66 | * @ORM\Column(name="content", type="text", nullable=true) |
9d50517c | 67 | */ |
eacaf7f8 | 68 | private $content; |
9d50517c | 69 | |
34d15eb4 NL |
70 | /** |
71 | * @var date | |
72 | * | |
73 | * @ORM\Column(name="created_at", type="datetime", nullable=true) | |
74 | */ | |
75 | private $createdAt; | |
76 | ||
77 | /** | |
78 | * @var date | |
79 | * | |
80 | * @ORM\Column(name="updated_at", type="datetime", nullable=true) | |
81 | */ | |
82 | private $updatedAt; | |
83 | ||
42a90646 NL |
84 | /** |
85 | * @var string | |
86 | * | |
eacaf7f8 | 87 | * @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true) |
42a90646 | 88 | */ |
eacaf7f8 | 89 | private $userId; |
42a90646 | 90 | |
34d15eb4 NL |
91 | /** |
92 | * @var string | |
93 | * | |
94 | * @ORM\Column(name="comments", type="text", nullable=true) | |
95 | */ | |
96 | private $comments; | |
97 | ||
98 | /** | |
99 | * @var string | |
100 | * | |
101 | * @ORM\Column(name="mimetype", type="text", nullable=true) | |
102 | */ | |
103 | private $mimetype; | |
104 | ||
105 | /** | |
106 | * @var integer | |
107 | * | |
108 | * @ORM\Column(name="reading_type", type="integer", nullable=true) | |
109 | */ | |
110 | private $readingTime; | |
111 | ||
112 | /** | |
113 | * @var string | |
114 | * | |
115 | * @ORM\Column(name="domain_name", type="text", nullable=true) | |
116 | */ | |
117 | private $domainName; | |
118 | ||
119 | /** | |
120 | * @var boolean | |
121 | * | |
122 | * @ORM\Column(name="is_public", type="boolean", nullable=true, options={"default" = false}) | |
123 | */ | |
124 | private $isPublic; | |
125 | ||
9d50517c NL |
126 | /** |
127 | * Get id | |
128 | * | |
7df80cb3 | 129 | * @return integer |
9d50517c NL |
130 | */ |
131 | public function getId() | |
132 | { | |
133 | return $this->id; | |
134 | } | |
135 | ||
136 | /** | |
137 | * Set title | |
138 | * | |
7df80cb3 | 139 | * @param string $title |
9d50517c NL |
140 | * @return Entries |
141 | */ | |
142 | public function setTitle($title) | |
143 | { | |
144 | $this->title = $title; | |
145 | ||
146 | return $this; | |
147 | } | |
148 | ||
149 | /** | |
150 | * Get title | |
151 | * | |
7df80cb3 | 152 | * @return string |
9d50517c NL |
153 | */ |
154 | public function getTitle() | |
155 | { | |
156 | return $this->title; | |
157 | } | |
158 | ||
159 | /** | |
160 | * Set url | |
161 | * | |
7df80cb3 | 162 | * @param string $url |
9d50517c NL |
163 | * @return Entries |
164 | */ | |
165 | public function setUrl($url) | |
166 | { | |
167 | $this->url = $url; | |
168 | ||
169 | return $this; | |
170 | } | |
171 | ||
172 | /** | |
173 | * Get url | |
174 | * | |
7df80cb3 | 175 | * @return string |
9d50517c NL |
176 | */ |
177 | public function getUrl() | |
178 | { | |
179 | return $this->url; | |
180 | } | |
181 | ||
182 | /** | |
183 | * Set isRead | |
184 | * | |
7df80cb3 | 185 | * @param string $isRead |
9d50517c NL |
186 | * @return Entries |
187 | */ | |
2c093b03 | 188 | public function setRead($isRead) |
9d50517c NL |
189 | { |
190 | $this->isRead = $isRead; | |
191 | ||
192 | return $this; | |
193 | } | |
194 | ||
195 | /** | |
196 | * Get isRead | |
197 | * | |
7df80cb3 | 198 | * @return string |
9d50517c | 199 | */ |
2c093b03 | 200 | public function isRead() |
9d50517c NL |
201 | { |
202 | return $this->isRead; | |
203 | } | |
204 | ||
163eae0b NL |
205 | public function toggleArchive() |
206 | { | |
207 | $this->isRead = $this->getIsRead() ^ 1; | |
7df80cb3 | 208 | |
163eae0b NL |
209 | return $this; |
210 | } | |
211 | ||
9d50517c NL |
212 | /** |
213 | * Set isFav | |
214 | * | |
7df80cb3 | 215 | * @param string $isFav |
9d50517c NL |
216 | * @return Entries |
217 | */ | |
2c093b03 | 218 | public function setFav($isFav) |
9d50517c NL |
219 | { |
220 | $this->isFav = $isFav; | |
221 | ||
222 | return $this; | |
223 | } | |
224 | ||
225 | /** | |
226 | * Get isFav | |
227 | * | |
7df80cb3 | 228 | * @return string |
9d50517c | 229 | */ |
2c093b03 | 230 | public function isFav() |
9d50517c NL |
231 | { |
232 | return $this->isFav; | |
233 | } | |
234 | ||
163eae0b NL |
235 | public function toggleStar() |
236 | { | |
237 | $this->isFav = $this->getIsFav() ^ 1; | |
238 | ||
239 | return $this; | |
240 | } | |
241 | ||
9d50517c NL |
242 | /** |
243 | * Set content | |
244 | * | |
7df80cb3 | 245 | * @param string $content |
9d50517c NL |
246 | * @return Entries |
247 | */ | |
248 | public function setContent($content) | |
249 | { | |
250 | $this->content = $content; | |
251 | ||
252 | return $this; | |
253 | } | |
254 | ||
255 | /** | |
256 | * Get content | |
257 | * | |
7df80cb3 | 258 | * @return string |
9d50517c NL |
259 | */ |
260 | public function getContent() | |
261 | { | |
262 | return $this->content; | |
263 | } | |
264 | ||
265 | /** | |
266 | * Set userId | |
267 | * | |
7df80cb3 | 268 | * @param string $userId |
9d50517c NL |
269 | * @return Entries |
270 | */ | |
271 | public function setUserId($userId) | |
272 | { | |
273 | $this->userId = $userId; | |
274 | ||
275 | return $this; | |
276 | } | |
277 | ||
278 | /** | |
279 | * Get userId | |
280 | * | |
7df80cb3 | 281 | * @return string |
9d50517c NL |
282 | */ |
283 | public function getUserId() | |
284 | { | |
285 | return $this->userId; | |
286 | } | |
42a90646 NL |
287 | |
288 | /** | |
289 | * @return string | |
290 | */ | |
291 | public function isDeleted() | |
292 | { | |
293 | return $this->isDeleted; | |
294 | } | |
295 | ||
296 | /** | |
297 | * @param string $isDeleted | |
298 | */ | |
299 | public function setDeleted($isDeleted) | |
300 | { | |
301 | $this->isDeleted = $isDeleted; | |
302 | } | |
34d15eb4 NL |
303 | |
304 | /** | |
305 | * @return mixed | |
306 | */ | |
307 | public function getCreatedAt() | |
308 | { | |
309 | return $this->createdAt; | |
310 | } | |
311 | ||
312 | /** | |
313 | * @param mixed $createdAt | |
314 | * @ORM\PrePersist | |
315 | */ | |
316 | public function setCreatedAt() | |
317 | { | |
318 | $this->createdAt = new \DateTime(); | |
319 | } | |
320 | ||
321 | /** | |
322 | * @return string | |
323 | */ | |
324 | public function getUpdatedAt() | |
325 | { | |
326 | return $this->updatedAt; | |
327 | } | |
328 | ||
329 | /** | |
330 | * @param string $updatedAt | |
331 | * @ORM\PreUpdate | |
332 | */ | |
333 | public function setUpdatedAt() | |
334 | { | |
335 | $this->updatedAt = new \DateTime(); | |
336 | } | |
337 | ||
338 | /** | |
339 | * @return string | |
340 | */ | |
341 | public function getComments() | |
342 | { | |
343 | return $this->comments; | |
344 | } | |
345 | ||
346 | /** | |
347 | * @param string $comments | |
348 | */ | |
349 | public function setComments($comments) | |
350 | { | |
351 | $this->comments = $comments; | |
352 | } | |
353 | ||
354 | /** | |
355 | * @return string | |
356 | */ | |
357 | public function getMimetype() | |
358 | { | |
359 | return $this->mimetype; | |
360 | } | |
361 | ||
362 | /** | |
363 | * @param string $mimetype | |
364 | */ | |
365 | public function setMimetype($mimetype) | |
366 | { | |
367 | $this->mimetype = $mimetype; | |
368 | } | |
369 | ||
370 | /** | |
371 | * @return int | |
372 | */ | |
373 | public function getReadingTime() | |
374 | { | |
375 | return $this->readingTime; | |
376 | } | |
377 | ||
378 | /** | |
379 | * @param int $readingTime | |
380 | */ | |
381 | public function setReadingTime($readingTime) | |
382 | { | |
383 | $this->readingTime = $readingTime; | |
384 | } | |
385 | ||
386 | /** | |
387 | * @return string | |
388 | */ | |
389 | public function getDomainName() | |
390 | { | |
391 | return $this->domainName; | |
392 | } | |
393 | ||
394 | /** | |
395 | * @param string $domainName | |
396 | */ | |
397 | public function setDomainName($domainName) | |
398 | { | |
399 | $this->domainName = $domainName; | |
400 | } | |
401 | ||
402 | /** | |
403 | * @return boolean | |
404 | */ | |
2c093b03 | 405 | public function isPublic() |
34d15eb4 NL |
406 | { |
407 | return $this->isPublic; | |
408 | } | |
409 | ||
410 | /** | |
411 | * @param boolean $isPublic | |
412 | */ | |
2c093b03 | 413 | public function setPublic($isPublic) |
34d15eb4 NL |
414 | { |
415 | $this->isPublic = $isPublic; | |
416 | } | |
9d50517c | 417 | } |