aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity/Entry.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php')
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php49
1 files changed, 48 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index 2b1f2e05..b3cfdc4a 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -87,6 +87,15 @@ class Entry
87 private $isArchived = false; 87 private $isArchived = false;
88 88
89 /** 89 /**
90 * @var \DateTime
91 *
92 * @ORM\Column(name="archived_at", type="datetime", nullable=true)
93 *
94 * @Groups({"entries_for_user", "export_all"})
95 */
96 private $archivedAt = null;
97
98 /**
90 * @var bool 99 * @var bool
91 * 100 *
92 * @Exclude 101 * @Exclude
@@ -336,6 +345,44 @@ class Entry
336 } 345 }
337 346
338 /** 347 /**
348 * update isArchived and archive_at fields.
349 *
350 * @param bool $isArchived
351 *
352 * @return Entry
353 */
354 public function updateArchived($isArchived = false)
355 {
356 $this->setArchived($isArchived);
357 $this->setArchivedAt(null);
358 if ($this->isArchived()) {
359 $this->setArchivedAt(new \DateTime());
360 }
361
362 return $this;
363 }
364
365 /**
366 * @return \DateTime|null
367 */
368 public function getArchivedAt()
369 {
370 return $this->archivedAt;
371 }
372
373 /**
374 * @param \DateTime|null $archivedAt
375 *
376 * @return Entry
377 */
378 public function setArchivedAt($archivedAt = null)
379 {
380 $this->archivedAt = $archivedAt;
381
382 return $this;
383 }
384
385 /**
339 * Get isArchived. 386 * Get isArchived.
340 * 387 *
341 * @return bool 388 * @return bool
@@ -357,7 +404,7 @@ class Entry
357 404
358 public function toggleArchive() 405 public function toggleArchive()
359 { 406 {
360 $this->isArchived = $this->isArchived() ^ 1; 407 $this->updateArchived($this->isArchived() ^ 1);
361 408
362 return $this; 409 return $this;
363 } 410 }