diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 129 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/SiteCredential.php | 195 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/TaggingRule.php | 4 |
3 files changed, 300 insertions, 28 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 7276b437..a0503c39 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -122,6 +122,24 @@ class Entry | |||
122 | private $updatedAt; | 122 | private $updatedAt; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * @var \DateTime | ||
126 | * | ||
127 | * @ORM\Column(name="published_at", type="datetime", nullable=true) | ||
128 | * | ||
129 | * @Groups({"entries_for_user", "export_all"}) | ||
130 | */ | ||
131 | private $publishedAt; | ||
132 | |||
133 | /** | ||
134 | * @var array | ||
135 | * | ||
136 | * @ORM\Column(name="published_by", type="array", nullable=true) | ||
137 | * | ||
138 | * @Groups({"entries_for_user", "export_all"}) | ||
139 | */ | ||
140 | private $publishedBy; | ||
141 | |||
142 | /** | ||
125 | * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) | 143 | * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) |
126 | * @ORM\JoinTable | 144 | * @ORM\JoinTable |
127 | * | 145 | * |
@@ -175,22 +193,22 @@ class Entry | |||
175 | private $previewPicture; | 193 | private $previewPicture; |
176 | 194 | ||
177 | /** | 195 | /** |
178 | * @var bool | 196 | * @var string |
179 | * | 197 | * |
180 | * @ORM\Column(name="is_public", type="boolean", nullable=true, options={"default" = false}) | 198 | * @ORM\Column(name="http_status", type="string", length=3, nullable=true) |
181 | * | 199 | * |
182 | * @Groups({"export_all"}) | 200 | * @Groups({"entries_for_user", "export_all"}) |
183 | */ | 201 | */ |
184 | private $isPublic; | 202 | private $httpStatus; |
185 | 203 | ||
186 | /** | 204 | /** |
187 | * @var string | 205 | * @var array |
188 | * | 206 | * |
189 | * @ORM\Column(name="http_status", type="string", length=3, nullable=true) | 207 | * @ORM\Column(name="headers", type="array", nullable=true) |
190 | * | 208 | * |
191 | * @Groups({"entries_for_user", "export_all"}) | 209 | * @Groups({"entries_for_user", "export_all"}) |
192 | */ | 210 | */ |
193 | private $httpStatus; | 211 | private $headers; |
194 | 212 | ||
195 | /** | 213 | /** |
196 | * @Exclude | 214 | * @Exclude |
@@ -532,23 +550,7 @@ class Entry | |||
532 | } | 550 | } |
533 | 551 | ||
534 | /** | 552 | /** |
535 | * @return bool | 553 | * @return ArrayCollection |
536 | */ | ||
537 | public function isPublic() | ||
538 | { | ||
539 | return $this->isPublic; | ||
540 | } | ||
541 | |||
542 | /** | ||
543 | * @param bool $isPublic | ||
544 | */ | ||
545 | public function setIsPublic($isPublic) | ||
546 | { | ||
547 | $this->isPublic = $isPublic; | ||
548 | } | ||
549 | |||
550 | /** | ||
551 | * @return ArrayCollection<Tag> | ||
552 | */ | 554 | */ |
553 | public function getTags() | 555 | public function getTags() |
554 | { | 556 | { |
@@ -683,7 +685,22 @@ class Entry | |||
683 | } | 685 | } |
684 | 686 | ||
685 | /** | 687 | /** |
686 | * @return int | 688 | * Used in the entries filter so it's more explicit for the end user than the uid. |
689 | * Also used in the API. | ||
690 | * | ||
691 | * @VirtualProperty | ||
692 | * @SerializedName("is_public") | ||
693 | * @Groups({"entries_for_user"}) | ||
694 | * | ||
695 | * @return bool | ||
696 | */ | ||
697 | public function isPublic() | ||
698 | { | ||
699 | return null !== $this->uid; | ||
700 | } | ||
701 | |||
702 | /** | ||
703 | * @return string | ||
687 | */ | 704 | */ |
688 | public function getHttpStatus() | 705 | public function getHttpStatus() |
689 | { | 706 | { |
@@ -691,7 +708,7 @@ class Entry | |||
691 | } | 708 | } |
692 | 709 | ||
693 | /** | 710 | /** |
694 | * @param int $httpStatus | 711 | * @param string $httpStatus |
695 | * | 712 | * |
696 | * @return Entry | 713 | * @return Entry |
697 | */ | 714 | */ |
@@ -701,4 +718,64 @@ class Entry | |||
701 | 718 | ||
702 | return $this; | 719 | return $this; |
703 | } | 720 | } |
721 | |||
722 | /** | ||
723 | * @return \Datetime | ||
724 | */ | ||
725 | public function getPublishedAt() | ||
726 | { | ||
727 | return $this->publishedAt; | ||
728 | } | ||
729 | |||
730 | /** | ||
731 | * @param \Datetime $publishedAt | ||
732 | * | ||
733 | * @return Entry | ||
734 | */ | ||
735 | public function setPublishedAt(\Datetime $publishedAt) | ||
736 | { | ||
737 | $this->publishedAt = $publishedAt; | ||
738 | |||
739 | return $this; | ||
740 | } | ||
741 | |||
742 | /** | ||
743 | * @return array | ||
744 | */ | ||
745 | public function getPublishedBy() | ||
746 | { | ||
747 | return $this->publishedBy; | ||
748 | } | ||
749 | |||
750 | /** | ||
751 | * @param array $publishedBy | ||
752 | * | ||
753 | * @return Entry | ||
754 | */ | ||
755 | public function setPublishedBy($publishedBy) | ||
756 | { | ||
757 | $this->publishedBy = $publishedBy; | ||
758 | |||
759 | return $this; | ||
760 | } | ||
761 | |||
762 | /** | ||
763 | * @return array | ||
764 | */ | ||
765 | public function getHeaders() | ||
766 | { | ||
767 | return $this->headers; | ||
768 | } | ||
769 | |||
770 | /** | ||
771 | * @param array $headers | ||
772 | * | ||
773 | * @return Entry | ||
774 | */ | ||
775 | public function setHeaders($headers) | ||
776 | { | ||
777 | $this->headers = $headers; | ||
778 | |||
779 | return $this; | ||
780 | } | ||
704 | } | 781 | } |
diff --git a/src/Wallabag/CoreBundle/Entity/SiteCredential.php b/src/Wallabag/CoreBundle/Entity/SiteCredential.php new file mode 100644 index 00000000..58075e92 --- /dev/null +++ b/src/Wallabag/CoreBundle/Entity/SiteCredential.php | |||
@@ -0,0 +1,195 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Entity; | ||
4 | |||
5 | use Doctrine\ORM\Mapping as ORM; | ||
6 | use Symfony\Component\Validator\Constraints as Assert; | ||
7 | use Wallabag\UserBundle\Entity\User; | ||
8 | |||
9 | /** | ||
10 | * SiteCredential. | ||
11 | * | ||
12 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\SiteCredentialRepository") | ||
13 | * @ORM\Table(name="`site_credential`") | ||
14 | * @ORM\HasLifecycleCallbacks() | ||
15 | */ | ||
16 | class SiteCredential | ||
17 | { | ||
18 | /** | ||
19 | * @var int | ||
20 | * | ||
21 | * @ORM\Column(name="id", type="integer") | ||
22 | * @ORM\Id | ||
23 | * @ORM\GeneratedValue(strategy="AUTO") | ||
24 | */ | ||
25 | private $id; | ||
26 | |||
27 | /** | ||
28 | * @var string | ||
29 | * | ||
30 | * @Assert\NotBlank() | ||
31 | * @Assert\Length(max=255) | ||
32 | * @ORM\Column(name="host", type="string", length=255) | ||
33 | */ | ||
34 | private $host; | ||
35 | |||
36 | /** | ||
37 | * @var string | ||
38 | * | ||
39 | * @Assert\NotBlank() | ||
40 | * @ORM\Column(name="username", type="text") | ||
41 | */ | ||
42 | private $username; | ||
43 | |||
44 | /** | ||
45 | * @var string | ||
46 | * | ||
47 | * @Assert\NotBlank() | ||
48 | * @ORM\Column(name="password", type="text") | ||
49 | */ | ||
50 | private $password; | ||
51 | |||
52 | /** | ||
53 | * @var \DateTime | ||
54 | * | ||
55 | * @ORM\Column(name="createdAt", type="datetime") | ||
56 | */ | ||
57 | private $createdAt; | ||
58 | |||
59 | /** | ||
60 | * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="site_credentials") | ||
61 | */ | ||
62 | private $user; | ||
63 | |||
64 | /* | ||
65 | * @param User $user | ||
66 | */ | ||
67 | public function __construct(User $user) | ||
68 | { | ||
69 | $this->user = $user; | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * Get id. | ||
74 | * | ||
75 | * @return int | ||
76 | */ | ||
77 | public function getId() | ||
78 | { | ||
79 | return $this->id; | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * Set host. | ||
84 | * | ||
85 | * @param string $host | ||
86 | * | ||
87 | * @return SiteCredential | ||
88 | */ | ||
89 | public function setHost($host) | ||
90 | { | ||
91 | $this->host = $host; | ||
92 | |||
93 | return $this; | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * Get host. | ||
98 | * | ||
99 | * @return string | ||
100 | */ | ||
101 | public function getHost() | ||
102 | { | ||
103 | return $this->host; | ||
104 | } | ||
105 | |||
106 | /** | ||
107 | * Set username. | ||
108 | * | ||
109 | * @param string $username | ||
110 | * | ||
111 | * @return SiteCredential | ||
112 | */ | ||
113 | public function setUsername($username) | ||
114 | { | ||
115 | $this->username = $username; | ||
116 | |||
117 | return $this; | ||
118 | } | ||
119 | |||
120 | /** | ||
121 | * Get username. | ||
122 | * | ||
123 | * @return string | ||
124 | */ | ||
125 | public function getUsername() | ||
126 | { | ||
127 | return $this->username; | ||
128 | } | ||
129 | |||
130 | /** | ||
131 | * Set password. | ||
132 | * | ||
133 | * @param string $password | ||
134 | * | ||
135 | * @return SiteCredential | ||
136 | */ | ||
137 | public function setPassword($password) | ||
138 | { | ||
139 | $this->password = $password; | ||
140 | |||
141 | return $this; | ||
142 | } | ||
143 | |||
144 | /** | ||
145 | * Get password. | ||
146 | * | ||
147 | * @return string | ||
148 | */ | ||
149 | public function getPassword() | ||
150 | { | ||
151 | return $this->password; | ||
152 | } | ||
153 | |||
154 | /** | ||
155 | * Set createdAt. | ||
156 | * | ||
157 | * @param \DateTime $createdAt | ||
158 | * | ||
159 | * @return SiteCredential | ||
160 | */ | ||
161 | public function setCreatedAt($createdAt) | ||
162 | { | ||
163 | $this->createdAt = $createdAt; | ||
164 | |||
165 | return $this; | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * Get createdAt. | ||
170 | * | ||
171 | * @return \DateTime | ||
172 | */ | ||
173 | public function getCreatedAt() | ||
174 | { | ||
175 | return $this->createdAt; | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * @return User | ||
180 | */ | ||
181 | public function getUser() | ||
182 | { | ||
183 | return $this->user; | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * @ORM\PrePersist | ||
188 | */ | ||
189 | public function timestamps() | ||
190 | { | ||
191 | if (is_null($this->createdAt)) { | ||
192 | $this->createdAt = new \DateTime(); | ||
193 | } | ||
194 | } | ||
195 | } | ||
diff --git a/src/Wallabag/CoreBundle/Entity/TaggingRule.php b/src/Wallabag/CoreBundle/Entity/TaggingRule.php index 72651b19..84e11e26 100644 --- a/src/Wallabag/CoreBundle/Entity/TaggingRule.php +++ b/src/Wallabag/CoreBundle/Entity/TaggingRule.php | |||
@@ -31,7 +31,7 @@ class TaggingRule | |||
31 | * @Assert\Length(max=255) | 31 | * @Assert\Length(max=255) |
32 | * @RulerZAssert\ValidRule( | 32 | * @RulerZAssert\ValidRule( |
33 | * allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"}, | 33 | * allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"}, |
34 | * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches"} | 34 | * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches", "notmatches"} |
35 | * ) | 35 | * ) |
36 | * @ORM\Column(name="rule", type="string", nullable=false) | 36 | * @ORM\Column(name="rule", type="string", nullable=false) |
37 | */ | 37 | */ |
@@ -87,7 +87,7 @@ class TaggingRule | |||
87 | /** | 87 | /** |
88 | * Set tags. | 88 | * Set tags. |
89 | * | 89 | * |
90 | * @param array<string> $tags | 90 | * @param array <string> $tags |
91 | * | 91 | * |
92 | * @return TaggingRule | 92 | * @return TaggingRule |
93 | */ | 93 | */ |