]>
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 | /** | |
be463487 | 9 | * Entry |
9d50517c | 10 | * |
be463487 NL |
11 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository") |
12 | * @ORM\Table(name="entry") | |
34d15eb4 | 13 | * @ORM\HasLifecycleCallbacks() |
c3235553 | 14 | * |
9d50517c | 15 | */ |
be463487 | 16 | class Entry |
9d50517c NL |
17 | { |
18 | /** | |
19 | * @var integer | |
20 | * | |
be463487 | 21 | * @ORM\Column(name="id", type="integer") |
9d50517c | 22 | * @ORM\Id |
34d15eb4 | 23 | * @ORM\GeneratedValue(strategy="AUTO") |
9d50517c | 24 | */ |
be463487 | 25 | private $id; |
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 | * |
be463487 | 45 | * @ORM\Column(name="is_archived", type="boolean") |
9d50517c | 46 | */ |
905ae369 | 47 | private $isArchived = false; |
9d50517c NL |
48 | |
49 | /** | |
eacaf7f8 | 50 | * @var boolean |
9d50517c | 51 | * |
be463487 | 52 | * @ORM\Column(name="is_starred", type="boolean") |
9d50517c | 53 | */ |
905ae369 | 54 | private $isStarred = false; |
9d50517c NL |
55 | |
56 | /** | |
eacaf7f8 | 57 | * @var boolean |
9d50517c | 58 | * |
be463487 | 59 | * @ORM\Column(name="is_deleted", type="boolean") |
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 | * | |
be463487 | 73 | * @ORM\Column(name="created_at", type="datetime") |
34d15eb4 NL |
74 | */ |
75 | private $createdAt; | |
76 | ||
77 | /** | |
78 | * @var date | |
79 | * | |
be463487 | 80 | * @ORM\Column(name="updated_at", type="datetime") |
34d15eb4 NL |
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 | * | |
be463487 NL |
139 | * @param string $title |
140 | * @return Entry | |
9d50517c NL |
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 | * | |
be463487 NL |
162 | * @param string $url |
163 | * @return Entry | |
9d50517c NL |
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 | /** | |
905ae369 | 183 | * Set isArchived |
9d50517c | 184 | * |
be463487 NL |
185 | * @param string $isArchived |
186 | * @return Entry | |
9d50517c | 187 | */ |
905ae369 | 188 | public function setArchived($isArchived) |
9d50517c | 189 | { |
905ae369 | 190 | $this->isArchived = $isArchived; |
9d50517c NL |
191 | |
192 | return $this; | |
193 | } | |
194 | ||
195 | /** | |
905ae369 | 196 | * Get isArchived |
9d50517c | 197 | * |
7df80cb3 | 198 | * @return string |
9d50517c | 199 | */ |
905ae369 | 200 | public function isArchived() |
9d50517c | 201 | { |
905ae369 | 202 | return $this->isArchived; |
9d50517c NL |
203 | } |
204 | ||
163eae0b NL |
205 | public function toggleArchive() |
206 | { | |
905ae369 | 207 | $this->isArchived = $this->isArchived() ^ 1; |
7df80cb3 | 208 | |
163eae0b NL |
209 | return $this; |
210 | } | |
211 | ||
9d50517c | 212 | /** |
905ae369 | 213 | * Set isStarred |
9d50517c | 214 | * |
be463487 NL |
215 | * @param string $isStarred |
216 | * @return Entry | |
9d50517c | 217 | */ |
905ae369 | 218 | public function setStarred($isStarred) |
9d50517c | 219 | { |
905ae369 | 220 | $this->isStarred = $isStarred; |
9d50517c NL |
221 | |
222 | return $this; | |
223 | } | |
224 | ||
225 | /** | |
905ae369 | 226 | * Get isStarred |
9d50517c | 227 | * |
7df80cb3 | 228 | * @return string |
9d50517c | 229 | */ |
905ae369 | 230 | public function isStarred() |
9d50517c | 231 | { |
905ae369 | 232 | return $this->isStarred; |
9d50517c NL |
233 | } |
234 | ||
163eae0b NL |
235 | public function toggleStar() |
236 | { | |
905ae369 | 237 | $this->isStarred = $this->isStarred() ^ 1; |
163eae0b NL |
238 | |
239 | return $this; | |
240 | } | |
241 | ||
9d50517c NL |
242 | /** |
243 | * Set content | |
244 | * | |
be463487 NL |
245 | * @param string $content |
246 | * @return Entry | |
9d50517c NL |
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 | * | |
be463487 NL |
268 | * @param string $userId |
269 | * @return Entry | |
9d50517c NL |
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 | /** | |
2f69eb4a | 305 | * @return string |
34d15eb4 NL |
306 | */ |
307 | public function getCreatedAt() | |
308 | { | |
309 | return $this->createdAt; | |
310 | } | |
311 | ||
34d15eb4 NL |
312 | /** |
313 | * @return string | |
314 | */ | |
315 | public function getUpdatedAt() | |
316 | { | |
317 | return $this->updatedAt; | |
318 | } | |
319 | ||
320 | /** | |
be463487 | 321 | * @ORM\PrePersist |
34d15eb4 NL |
322 | * @ORM\PreUpdate |
323 | */ | |
be463487 | 324 | public function timestamps() |
34d15eb4 | 325 | { |
be463487 NL |
326 | if (is_null($this->createdAt)) { |
327 | $this->createdAt = new \DateTime(); | |
328 | } | |
329 | ||
34d15eb4 NL |
330 | $this->updatedAt = new \DateTime(); |
331 | } | |
332 | ||
333 | /** | |
334 | * @return string | |
335 | */ | |
336 | public function getComments() | |
337 | { | |
338 | return $this->comments; | |
339 | } | |
340 | ||
341 | /** | |
342 | * @param string $comments | |
343 | */ | |
344 | public function setComments($comments) | |
345 | { | |
346 | $this->comments = $comments; | |
347 | } | |
348 | ||
349 | /** | |
350 | * @return string | |
351 | */ | |
352 | public function getMimetype() | |
353 | { | |
354 | return $this->mimetype; | |
355 | } | |
356 | ||
357 | /** | |
358 | * @param string $mimetype | |
359 | */ | |
360 | public function setMimetype($mimetype) | |
361 | { | |
362 | $this->mimetype = $mimetype; | |
363 | } | |
364 | ||
365 | /** | |
366 | * @return int | |
367 | */ | |
368 | public function getReadingTime() | |
369 | { | |
370 | return $this->readingTime; | |
371 | } | |
372 | ||
373 | /** | |
374 | * @param int $readingTime | |
375 | */ | |
376 | public function setReadingTime($readingTime) | |
377 | { | |
378 | $this->readingTime = $readingTime; | |
379 | } | |
380 | ||
381 | /** | |
382 | * @return string | |
383 | */ | |
384 | public function getDomainName() | |
385 | { | |
386 | return $this->domainName; | |
387 | } | |
388 | ||
389 | /** | |
390 | * @param string $domainName | |
391 | */ | |
392 | public function setDomainName($domainName) | |
393 | { | |
394 | $this->domainName = $domainName; | |
395 | } | |
396 | ||
397 | /** | |
398 | * @return boolean | |
399 | */ | |
2c093b03 | 400 | public function isPublic() |
34d15eb4 NL |
401 | { |
402 | return $this->isPublic; | |
403 | } | |
404 | ||
405 | /** | |
406 | * @param boolean $isPublic | |
407 | */ | |
2c093b03 | 408 | public function setPublic($isPublic) |
34d15eb4 NL |
409 | { |
410 | $this->isPublic = $isPublic; | |
411 | } | |
9d50517c | 412 | } |