aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php38
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php80
-rw-r--r--src/Wallabag/CoreBundle/Entity/SiteCredential.php17
-rw-r--r--src/Wallabag/CoreBundle/Entity/TaggingRule.php2
4 files changed, 115 insertions, 22 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
index b902ae2c..c6e65d66 100644
--- a/src/Wallabag/CoreBundle/Entity/Config.php
+++ b/src/Wallabag/CoreBundle/Entity/Config.php
@@ -60,21 +60,21 @@ class Config
60 /** 60 /**
61 * @var string 61 * @var string
62 * 62 *
63 * @ORM\Column(name="rss_token", type="string", nullable=true) 63 * @ORM\Column(name="feed_token", type="string", nullable=true)
64 */ 64 */
65 private $rssToken; 65 private $feedToken;
66 66
67 /** 67 /**
68 * @var int 68 * @var int
69 * 69 *
70 * @ORM\Column(name="rss_limit", type="integer", nullable=true) 70 * @ORM\Column(name="feed_limit", type="integer", nullable=true)
71 * @Assert\Range( 71 * @Assert\Range(
72 * min = 1, 72 * min = 1,
73 * max = 100000, 73 * max = 100000,
74 * maxMessage = "validator.rss_limit_too_high" 74 * maxMessage = "validator.feed_limit_too_high"
75 * ) 75 * )
76 */ 76 */
77 private $rssLimit; 77 private $feedLimit;
78 78
79 /** 79 /**
80 * @var float 80 * @var float
@@ -231,51 +231,51 @@ class Config
231 } 231 }
232 232
233 /** 233 /**
234 * Set rssToken. 234 * Set feed Token.
235 * 235 *
236 * @param string $rssToken 236 * @param string $feedToken
237 * 237 *
238 * @return Config 238 * @return Config
239 */ 239 */
240 public function setRssToken($rssToken) 240 public function setFeedToken($feedToken)
241 { 241 {
242 $this->rssToken = $rssToken; 242 $this->feedToken = $feedToken;
243 243
244 return $this; 244 return $this;
245 } 245 }
246 246
247 /** 247 /**
248 * Get rssToken. 248 * Get feedToken.
249 * 249 *
250 * @return string 250 * @return string
251 */ 251 */
252 public function getRssToken() 252 public function getFeedToken()
253 { 253 {
254 return $this->rssToken; 254 return $this->feedToken;
255 } 255 }
256 256
257 /** 257 /**
258 * Set rssLimit. 258 * Set Feed Limit.
259 * 259 *
260 * @param int $rssLimit 260 * @param int $feedLimit
261 * 261 *
262 * @return Config 262 * @return Config
263 */ 263 */
264 public function setRssLimit($rssLimit) 264 public function setFeedLimit($feedLimit)
265 { 265 {
266 $this->rssLimit = $rssLimit; 266 $this->feedLimit = $feedLimit;
267 267
268 return $this; 268 return $this;
269 } 269 }
270 270
271 /** 271 /**
272 * Get rssLimit. 272 * Get Feed Limit.
273 * 273 *
274 * @return int 274 * @return int
275 */ 275 */
276 public function getRssLimit() 276 public function getFeedLimit()
277 { 277 {
278 return $this->rssLimit; 278 return $this->feedLimit;
279 } 279 }
280 280
281 /** 281 /**
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index 2b1f2e05..c3fb87d2 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -25,7 +25,8 @@ use Wallabag\UserBundle\Entity\User;
25 * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, 25 * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"},
26 * indexes={ 26 * indexes={
27 * @ORM\Index(name="created_at", columns={"created_at"}), 27 * @ORM\Index(name="created_at", columns={"created_at"}),
28 * @ORM\Index(name="uid", columns={"uid"}) 28 * @ORM\Index(name="uid", columns={"uid"}),
29 * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}})
29 * } 30 * }
30 * ) 31 * )
31 * @ORM\HasLifecycleCallbacks() 32 * @ORM\HasLifecycleCallbacks()
@@ -76,6 +77,13 @@ class Entry
76 private $url; 77 private $url;
77 78
78 /** 79 /**
80 * @var string
81 *
82 * @ORM\Column(name="hashed_url", type="string", length=40, nullable=true)
83 */
84 private $hashedUrl;
85
86 /**
79 * @var bool 87 * @var bool
80 * 88 *
81 * @Exclude 89 * @Exclude
@@ -87,6 +95,15 @@ class Entry
87 private $isArchived = false; 95 private $isArchived = false;
88 96
89 /** 97 /**
98 * @var \DateTime
99 *
100 * @ORM\Column(name="archived_at", type="datetime", nullable=true)
101 *
102 * @Groups({"entries_for_user", "export_all"})
103 */
104 private $archivedAt = null;
105
106 /**
90 * @var bool 107 * @var bool
91 * 108 *
92 * @Exclude 109 * @Exclude
@@ -307,6 +324,7 @@ class Entry
307 public function setUrl($url) 324 public function setUrl($url)
308 { 325 {
309 $this->url = $url; 326 $this->url = $url;
327 $this->hashedUrl = hash('sha1', $url);
310 328
311 return $this; 329 return $this;
312 } 330 }
@@ -336,6 +354,44 @@ class Entry
336 } 354 }
337 355
338 /** 356 /**
357 * update isArchived and archive_at fields.
358 *
359 * @param bool $isArchived
360 *
361 * @return Entry
362 */
363 public function updateArchived($isArchived = false)
364 {
365 $this->setArchived($isArchived);
366 $this->setArchivedAt(null);
367 if ($this->isArchived()) {
368 $this->setArchivedAt(new \DateTime());
369 }
370
371 return $this;
372 }
373
374 /**
375 * @return \DateTime|null
376 */
377 public function getArchivedAt()
378 {
379 return $this->archivedAt;
380 }
381
382 /**
383 * @param \DateTime|null $archivedAt
384 *
385 * @return Entry
386 */
387 public function setArchivedAt($archivedAt = null)
388 {
389 $this->archivedAt = $archivedAt;
390
391 return $this;
392 }
393
394 /**
339 * Get isArchived. 395 * Get isArchived.
340 * 396 *
341 * @return bool 397 * @return bool
@@ -357,7 +413,7 @@ class Entry
357 413
358 public function toggleArchive() 414 public function toggleArchive()
359 { 415 {
360 $this->isArchived = $this->isArchived() ^ 1; 416 $this->updateArchived($this->isArchived() ^ 1);
361 417
362 return $this; 418 return $this;
363 } 419 }
@@ -864,4 +920,24 @@ class Entry
864 { 920 {
865 return $this->originUrl; 921 return $this->originUrl;
866 } 922 }
923
924 /**
925 * @return string
926 */
927 public function getHashedUrl()
928 {
929 return $this->hashedUrl;
930 }
931
932 /**
933 * @param mixed $hashedUrl
934 *
935 * @return Entry
936 */
937 public function setHashedUrl($hashedUrl)
938 {
939 $this->hashedUrl = $hashedUrl;
940
941 return $this;
942 }
867} 943}
diff --git a/src/Wallabag/CoreBundle/Entity/SiteCredential.php b/src/Wallabag/CoreBundle/Entity/SiteCredential.php
index ac714359..dee48fd5 100644
--- a/src/Wallabag/CoreBundle/Entity/SiteCredential.php
+++ b/src/Wallabag/CoreBundle/Entity/SiteCredential.php
@@ -60,6 +60,13 @@ class SiteCredential
60 private $createdAt; 60 private $createdAt;
61 61
62 /** 62 /**
63 * @var \DateTime
64 *
65 * @ORM\Column(name="updated_at", type="datetime")
66 */
67 private $updatedAt;
68
69 /**
63 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="siteCredentials") 70 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="siteCredentials")
64 */ 71 */
65 private $user; 72 private $user;
@@ -179,6 +186,16 @@ class SiteCredential
179 } 186 }
180 187
181 /** 188 /**
189 * Get updatedAt.
190 *
191 * @return \DateTime
192 */
193 public function getUpdatedAt()
194 {
195 return $this->updatedAt;
196 }
197
198 /**
182 * @return User 199 * @return User
183 */ 200 */
184 public function getUser() 201 public function getUser()
diff --git a/src/Wallabag/CoreBundle/Entity/TaggingRule.php b/src/Wallabag/CoreBundle/Entity/TaggingRule.php
index 84e11e26..c1be3165 100644
--- a/src/Wallabag/CoreBundle/Entity/TaggingRule.php
+++ b/src/Wallabag/CoreBundle/Entity/TaggingRule.php
@@ -3,7 +3,7 @@
3namespace Wallabag\CoreBundle\Entity; 3namespace Wallabag\CoreBundle\Entity;
4 4
5use Doctrine\ORM\Mapping as ORM; 5use Doctrine\ORM\Mapping as ORM;
6use KPhoen\RulerZBundle\Validator\Constraints as RulerZAssert; 6use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert;
7use Symfony\Component\Validator\Constraints as Assert; 7use Symfony\Component\Validator\Constraints as Assert;
8 8
9/** 9/**