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.php57
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php66
-rw-r--r--src/Wallabag/CoreBundle/Entity/TaggingRule.php1
3 files changed, 109 insertions, 15 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
index 69393ac9..b902ae2c 100644
--- a/src/Wallabag/CoreBundle/Entity/Config.php
+++ b/src/Wallabag/CoreBundle/Entity/Config.php
@@ -16,6 +16,9 @@ use Wallabag\UserBundle\Entity\User;
16 */ 16 */
17class Config 17class Config
18{ 18{
19 const REDIRECT_TO_HOMEPAGE = 0;
20 const REDIRECT_TO_CURRENT_PAGE = 1;
21
19 /** 22 /**
20 * @var int 23 * @var int
21 * 24 *
@@ -88,6 +91,20 @@ class Config
88 private $pocketConsumerKey; 91 private $pocketConsumerKey;
89 92
90 /** 93 /**
94 * @var int
95 *
96 * @ORM\Column(name="action_mark_as_read", type="integer", nullable=true, options={"default" = 0})
97 */
98 private $actionMarkAsRead;
99
100 /**
101 * @var int
102 *
103 * @ORM\Column(name="list_mode", type="integer", nullable=true)
104 */
105 private $listMode;
106
107 /**
91 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config") 108 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
92 */ 109 */
93 private $user; 110 private $user;
@@ -310,6 +327,46 @@ class Config
310 } 327 }
311 328
312 /** 329 /**
330 * @return int
331 */
332 public function getActionMarkAsRead()
333 {
334 return $this->actionMarkAsRead;
335 }
336
337 /**
338 * @param int $actionMarkAsRead
339 *
340 * @return Config
341 */
342 public function setActionMarkAsRead($actionMarkAsRead)
343 {
344 $this->actionMarkAsRead = $actionMarkAsRead;
345
346 return $this;
347 }
348
349 /**
350 * @return int
351 */
352 public function getListMode()
353 {
354 return $this->listMode;
355 }
356
357 /**
358 * @param int $listMode
359 *
360 * @return Config
361 */
362 public function setListMode($listMode)
363 {
364 $this->listMode = $listMode;
365
366 return $this;
367 }
368
369 /**
313 * @param TaggingRule $rule 370 * @param TaggingRule $rule
314 * 371 *
315 * @return Config 372 * @return Config
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index f2da3f4d..7276b437 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -19,7 +19,14 @@ use Wallabag\AnnotationBundle\Entity\Annotation;
19 * 19 *
20 * @XmlRoot("entry") 20 * @XmlRoot("entry")
21 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository") 21 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository")
22 * @ORM\Table(name="`entry`") 22 * @ORM\Table(
23 * name="`entry`",
24 * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"},
25 * indexes={
26 * @ORM\Index(name="created_at", columns={"created_at"}),
27 * @ORM\Index(name="uid", columns={"uid"})
28 * }
29 * )
23 * @ORM\HasLifecycleCallbacks() 30 * @ORM\HasLifecycleCallbacks()
24 * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())") 31 * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())")
25 */ 32 */
@@ -40,11 +47,11 @@ class Entry
40 /** 47 /**
41 * @var string 48 * @var string
42 * 49 *
43 * @ORM\Column(name="uuid", type="text", nullable=true) 50 * @ORM\Column(name="uid", type="string", length=23, nullable=true)
44 * 51 *
45 * @Groups({"entries_for_user", "export_all"}) 52 * @Groups({"entries_for_user", "export_all"})
46 */ 53 */
47 private $uuid; 54 private $uid;
48 55
49 /** 56 /**
50 * @var string 57 * @var string
@@ -177,6 +184,15 @@ class Entry
177 private $isPublic; 184 private $isPublic;
178 185
179 /** 186 /**
187 * @var string
188 *
189 * @ORM\Column(name="http_status", type="string", length=3, nullable=true)
190 *
191 * @Groups({"entries_for_user", "export_all"})
192 */
193 private $httpStatus;
194
195 /**
180 * @Exclude 196 * @Exclude
181 * 197 *
182 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries") 198 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries")
@@ -190,10 +206,10 @@ class Entry
190 * @ORM\JoinTable( 206 * @ORM\JoinTable(
191 * name="entry_tag", 207 * name="entry_tag",
192 * joinColumns={ 208 * joinColumns={
193 * @ORM\JoinColumn(name="entry_id", referencedColumnName="id") 209 * @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade")
194 * }, 210 * },
195 * inverseJoinColumns={ 211 * inverseJoinColumns={
196 * @ORM\JoinColumn(name="tag_id", referencedColumnName="id") 212 * @ORM\JoinColumn(name="tag_id", referencedColumnName="id", onDelete="cascade")
197 * } 213 * }
198 * ) 214 * )
199 */ 215 */
@@ -636,33 +652,53 @@ class Entry
636 /** 652 /**
637 * @return string 653 * @return string
638 */ 654 */
639 public function getUuid() 655 public function getUid()
640 { 656 {
641 return $this->uuid; 657 return $this->uid;
642 } 658 }
643 659
644 /** 660 /**
645 * @param string $uuid 661 * @param string $uid
646 * 662 *
647 * @return Entry 663 * @return Entry
648 */ 664 */
649 public function setUuid($uuid) 665 public function setUid($uid)
650 { 666 {
651 $this->uuid = $uuid; 667 $this->uid = $uid;
652 668
653 return $this; 669 return $this;
654 } 670 }
655 671
656 public function generateUuid() 672 public function generateUid()
657 { 673 {
658 if (null === $this->uuid) { 674 if (null === $this->uid) {
659 // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter 675 // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter
660 $this->uuid = uniqid('', true); 676 $this->uid = uniqid('', true);
661 } 677 }
662 } 678 }
663 679
664 public function cleanUuid() 680 public function cleanUid()
681 {
682 $this->uid = null;
683 }
684
685 /**
686 * @return int
687 */
688 public function getHttpStatus()
689 {
690 return $this->httpStatus;
691 }
692
693 /**
694 * @param int $httpStatus
695 *
696 * @return Entry
697 */
698 public function setHttpStatus($httpStatus)
665 { 699 {
666 $this->uuid = null; 700 $this->httpStatus = $httpStatus;
701
702 return $this;
667 } 703 }
668} 704}
diff --git a/src/Wallabag/CoreBundle/Entity/TaggingRule.php b/src/Wallabag/CoreBundle/Entity/TaggingRule.php
index 28914cc1..72651b19 100644
--- a/src/Wallabag/CoreBundle/Entity/TaggingRule.php
+++ b/src/Wallabag/CoreBundle/Entity/TaggingRule.php
@@ -28,6 +28,7 @@ class TaggingRule
28 * @var string 28 * @var string
29 * 29 *
30 * @Assert\NotBlank() 30 * @Assert\NotBlank()
31 * @Assert\Length(max=255)
31 * @RulerZAssert\ValidRule( 32 * @RulerZAssert\ValidRule(
32 * allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"}, 33 * allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"},
33 * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches"} 34 * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches"}