diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Config.php | 38 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 81 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/SiteCredential.php | 17 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/TaggingRule.php | 2 |
4 files changed, 116 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..1b4367fd 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -13,6 +13,7 @@ use JMS\Serializer\Annotation\XmlRoot; | |||
13 | use Symfony\Component\Validator\Constraints as Assert; | 13 | use Symfony\Component\Validator\Constraints as Assert; |
14 | use Wallabag\AnnotationBundle\Entity\Annotation; | 14 | use Wallabag\AnnotationBundle\Entity\Annotation; |
15 | use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; | 15 | use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; |
16 | use Wallabag\CoreBundle\Helper\UrlHasher; | ||
16 | use Wallabag\UserBundle\Entity\User; | 17 | use Wallabag\UserBundle\Entity\User; |
17 | 18 | ||
18 | /** | 19 | /** |
@@ -25,7 +26,8 @@ use Wallabag\UserBundle\Entity\User; | |||
25 | * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, | 26 | * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, |
26 | * indexes={ | 27 | * indexes={ |
27 | * @ORM\Index(name="created_at", columns={"created_at"}), | 28 | * @ORM\Index(name="created_at", columns={"created_at"}), |
28 | * @ORM\Index(name="uid", columns={"uid"}) | 29 | * @ORM\Index(name="uid", columns={"uid"}), |
30 | * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}) | ||
29 | * } | 31 | * } |
30 | * ) | 32 | * ) |
31 | * @ORM\HasLifecycleCallbacks() | 33 | * @ORM\HasLifecycleCallbacks() |
@@ -76,6 +78,13 @@ class Entry | |||
76 | private $url; | 78 | private $url; |
77 | 79 | ||
78 | /** | 80 | /** |
81 | * @var string | ||
82 | * | ||
83 | * @ORM\Column(name="hashed_url", type="string", length=40, nullable=true) | ||
84 | */ | ||
85 | private $hashedUrl; | ||
86 | |||
87 | /** | ||
79 | * @var bool | 88 | * @var bool |
80 | * | 89 | * |
81 | * @Exclude | 90 | * @Exclude |
@@ -87,6 +96,15 @@ class Entry | |||
87 | private $isArchived = false; | 96 | private $isArchived = false; |
88 | 97 | ||
89 | /** | 98 | /** |
99 | * @var \DateTime | ||
100 | * | ||
101 | * @ORM\Column(name="archived_at", type="datetime", nullable=true) | ||
102 | * | ||
103 | * @Groups({"entries_for_user", "export_all"}) | ||
104 | */ | ||
105 | private $archivedAt = null; | ||
106 | |||
107 | /** | ||
90 | * @var bool | 108 | * @var bool |
91 | * | 109 | * |
92 | * @Exclude | 110 | * @Exclude |
@@ -307,6 +325,7 @@ class Entry | |||
307 | public function setUrl($url) | 325 | public function setUrl($url) |
308 | { | 326 | { |
309 | $this->url = $url; | 327 | $this->url = $url; |
328 | $this->hashedUrl = UrlHasher::hashUrl($url); | ||
310 | 329 | ||
311 | return $this; | 330 | return $this; |
312 | } | 331 | } |
@@ -336,6 +355,44 @@ class Entry | |||
336 | } | 355 | } |
337 | 356 | ||
338 | /** | 357 | /** |
358 | * update isArchived and archive_at fields. | ||
359 | * | ||
360 | * @param bool $isArchived | ||
361 | * | ||
362 | * @return Entry | ||
363 | */ | ||
364 | public function updateArchived($isArchived = false) | ||
365 | { | ||
366 | $this->setArchived($isArchived); | ||
367 | $this->setArchivedAt(null); | ||
368 | if ($this->isArchived()) { | ||
369 | $this->setArchivedAt(new \DateTime()); | ||
370 | } | ||
371 | |||
372 | return $this; | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * @return \DateTime|null | ||
377 | */ | ||
378 | public function getArchivedAt() | ||
379 | { | ||
380 | return $this->archivedAt; | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * @param \DateTime|null $archivedAt | ||
385 | * | ||
386 | * @return Entry | ||
387 | */ | ||
388 | public function setArchivedAt($archivedAt = null) | ||
389 | { | ||
390 | $this->archivedAt = $archivedAt; | ||
391 | |||
392 | return $this; | ||
393 | } | ||
394 | |||
395 | /** | ||
339 | * Get isArchived. | 396 | * Get isArchived. |
340 | * | 397 | * |
341 | * @return bool | 398 | * @return bool |
@@ -357,7 +414,7 @@ class Entry | |||
357 | 414 | ||
358 | public function toggleArchive() | 415 | public function toggleArchive() |
359 | { | 416 | { |
360 | $this->isArchived = $this->isArchived() ^ 1; | 417 | $this->updateArchived($this->isArchived() ^ 1); |
361 | 418 | ||
362 | return $this; | 419 | return $this; |
363 | } | 420 | } |
@@ -864,4 +921,24 @@ class Entry | |||
864 | { | 921 | { |
865 | return $this->originUrl; | 922 | return $this->originUrl; |
866 | } | 923 | } |
924 | |||
925 | /** | ||
926 | * @return string | ||
927 | */ | ||
928 | public function getHashedUrl() | ||
929 | { | ||
930 | return $this->hashedUrl; | ||
931 | } | ||
932 | |||
933 | /** | ||
934 | * @param mixed $hashedUrl | ||
935 | * | ||
936 | * @return Entry | ||
937 | */ | ||
938 | public function setHashedUrl($hashedUrl) | ||
939 | { | ||
940 | $this->hashedUrl = $hashedUrl; | ||
941 | |||
942 | return $this; | ||
943 | } | ||
867 | } | 944 | } |
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 @@ | |||
3 | namespace Wallabag\CoreBundle\Entity; | 3 | namespace Wallabag\CoreBundle\Entity; |
4 | 4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | 5 | use Doctrine\ORM\Mapping as ORM; |
6 | use KPhoen\RulerZBundle\Validator\Constraints as RulerZAssert; | 6 | use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert; |
7 | use Symfony\Component\Validator\Constraints as Assert; | 7 | use Symfony\Component\Validator\Constraints as Assert; |
8 | 8 | ||
9 | /** | 9 | /** |