diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Config.php | 48 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 180 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/InternalSetting.php | 36 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/SiteCredential.php | 17 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Tag.php | 14 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/TaggingRule.php | 14 |
6 files changed, 251 insertions, 58 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index b902ae2c..fe7942ee 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php | |||
@@ -11,8 +11,12 @@ use Wallabag\UserBundle\Entity\User; | |||
11 | * Config. | 11 | * Config. |
12 | * | 12 | * |
13 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository") | 13 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository") |
14 | * @ORM\Table(name="`config`") | 14 | * @ORM\Table( |
15 | * @ORM\Entity | 15 | * name="`config`", |
16 | * indexes={ | ||
17 | * @ORM\Index(name="config_feed_token", columns={"feed_token"}, options={"lengths"={255}}), | ||
18 | * } | ||
19 | * ) | ||
16 | */ | 20 | */ |
17 | class Config | 21 | class Config |
18 | { | 22 | { |
@@ -60,21 +64,21 @@ class Config | |||
60 | /** | 64 | /** |
61 | * @var string | 65 | * @var string |
62 | * | 66 | * |
63 | * @ORM\Column(name="rss_token", type="string", nullable=true) | 67 | * @ORM\Column(name="feed_token", type="string", nullable=true) |
64 | */ | 68 | */ |
65 | private $rssToken; | 69 | private $feedToken; |
66 | 70 | ||
67 | /** | 71 | /** |
68 | * @var int | 72 | * @var int |
69 | * | 73 | * |
70 | * @ORM\Column(name="rss_limit", type="integer", nullable=true) | 74 | * @ORM\Column(name="feed_limit", type="integer", nullable=true) |
71 | * @Assert\Range( | 75 | * @Assert\Range( |
72 | * min = 1, | 76 | * min = 1, |
73 | * max = 100000, | 77 | * max = 100000, |
74 | * maxMessage = "validator.rss_limit_too_high" | 78 | * maxMessage = "validator.feed_limit_too_high" |
75 | * ) | 79 | * ) |
76 | */ | 80 | */ |
77 | private $rssLimit; | 81 | private $feedLimit; |
78 | 82 | ||
79 | /** | 83 | /** |
80 | * @var float | 84 | * @var float |
@@ -231,51 +235,51 @@ class Config | |||
231 | } | 235 | } |
232 | 236 | ||
233 | /** | 237 | /** |
234 | * Set rssToken. | 238 | * Set feed Token. |
235 | * | 239 | * |
236 | * @param string $rssToken | 240 | * @param string $feedToken |
237 | * | 241 | * |
238 | * @return Config | 242 | * @return Config |
239 | */ | 243 | */ |
240 | public function setRssToken($rssToken) | 244 | public function setFeedToken($feedToken) |
241 | { | 245 | { |
242 | $this->rssToken = $rssToken; | 246 | $this->feedToken = $feedToken; |
243 | 247 | ||
244 | return $this; | 248 | return $this; |
245 | } | 249 | } |
246 | 250 | ||
247 | /** | 251 | /** |
248 | * Get rssToken. | 252 | * Get feedToken. |
249 | * | 253 | * |
250 | * @return string | 254 | * @return string |
251 | */ | 255 | */ |
252 | public function getRssToken() | 256 | public function getFeedToken() |
253 | { | 257 | { |
254 | return $this->rssToken; | 258 | return $this->feedToken; |
255 | } | 259 | } |
256 | 260 | ||
257 | /** | 261 | /** |
258 | * Set rssLimit. | 262 | * Set Feed Limit. |
259 | * | 263 | * |
260 | * @param int $rssLimit | 264 | * @param int $feedLimit |
261 | * | 265 | * |
262 | * @return Config | 266 | * @return Config |
263 | */ | 267 | */ |
264 | public function setRssLimit($rssLimit) | 268 | public function setFeedLimit($feedLimit) |
265 | { | 269 | { |
266 | $this->rssLimit = $rssLimit; | 270 | $this->feedLimit = $feedLimit; |
267 | 271 | ||
268 | return $this; | 272 | return $this; |
269 | } | 273 | } |
270 | 274 | ||
271 | /** | 275 | /** |
272 | * Get rssLimit. | 276 | * Get Feed Limit. |
273 | * | 277 | * |
274 | * @return int | 278 | * @return int |
275 | */ | 279 | */ |
276 | public function getRssLimit() | 280 | public function getFeedLimit() |
277 | { | 281 | { |
278 | return $this->rssLimit; | 282 | return $this->feedLimit; |
279 | } | 283 | } |
280 | 284 | ||
281 | /** | 285 | /** |
@@ -367,8 +371,6 @@ class Config | |||
367 | } | 371 | } |
368 | 372 | ||
369 | /** | 373 | /** |
370 | * @param TaggingRule $rule | ||
371 | * | ||
372 | * @return Config | 374 | * @return Config |
373 | */ | 375 | */ |
374 | public function addTaggingRule(TaggingRule $rule) | 376 | public function addTaggingRule(TaggingRule $rule) |
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 2b1f2e05..19045798 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,13 @@ 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}}), | ||
31 | * @ORM\Index(name="hashed_given_url_user_id", columns={"user_id", "hashed_given_url"}, options={"lengths"={null, 40}}), | ||
32 | * @ORM\Index(name="user_language", columns={"language", "user_id"}), | ||
33 | * @ORM\Index(name="user_archived", columns={"user_id", "is_archived", "archived_at"}), | ||
34 | * @ORM\Index(name="user_created", columns={"user_id", "created_at"}), | ||
35 | * @ORM\Index(name="user_starred", columns={"user_id", "is_starred", "starred_at"}) | ||
29 | * } | 36 | * } |
30 | * ) | 37 | * ) |
31 | * @ORM\HasLifecycleCallbacks() | 38 | * @ORM\HasLifecycleCallbacks() |
@@ -66,6 +73,8 @@ class Entry | |||
66 | private $title; | 73 | private $title; |
67 | 74 | ||
68 | /** | 75 | /** |
76 | * Define the url fetched by wallabag (the final url after potential redirections). | ||
77 | * | ||
69 | * @var string | 78 | * @var string |
70 | * | 79 | * |
71 | * @Assert\NotBlank() | 80 | * @Assert\NotBlank() |
@@ -76,6 +85,42 @@ class Entry | |||
76 | private $url; | 85 | private $url; |
77 | 86 | ||
78 | /** | 87 | /** |
88 | * @var string | ||
89 | * | ||
90 | * @ORM\Column(name="hashed_url", type="string", length=40, nullable=true) | ||
91 | */ | ||
92 | private $hashedUrl; | ||
93 | |||
94 | /** | ||
95 | * From where user retrieved/found the url (an other article, a twitter, or the given_url if non are provided). | ||
96 | * | ||
97 | * @var string | ||
98 | * | ||
99 | * @ORM\Column(name="origin_url", type="text", nullable=true) | ||
100 | * | ||
101 | * @Groups({"entries_for_user", "export_all"}) | ||
102 | */ | ||
103 | private $originUrl; | ||
104 | |||
105 | /** | ||
106 | * Define the url entered by the user (without redirections). | ||
107 | * | ||
108 | * @var string | ||
109 | * | ||
110 | * @ORM\Column(name="given_url", type="text", nullable=true) | ||
111 | * | ||
112 | * @Groups({"entries_for_user", "export_all"}) | ||
113 | */ | ||
114 | private $givenUrl; | ||
115 | |||
116 | /** | ||
117 | * @var string | ||
118 | * | ||
119 | * @ORM\Column(name="hashed_given_url", type="string", length=40, nullable=true) | ||
120 | */ | ||
121 | private $hashedGivenUrl; | ||
122 | |||
123 | /** | ||
79 | * @var bool | 124 | * @var bool |
80 | * | 125 | * |
81 | * @Exclude | 126 | * @Exclude |
@@ -87,6 +132,15 @@ class Entry | |||
87 | private $isArchived = false; | 132 | private $isArchived = false; |
88 | 133 | ||
89 | /** | 134 | /** |
135 | * @var \DateTime | ||
136 | * | ||
137 | * @ORM\Column(name="archived_at", type="datetime", nullable=true) | ||
138 | * | ||
139 | * @Groups({"entries_for_user", "export_all"}) | ||
140 | */ | ||
141 | private $archivedAt = null; | ||
142 | |||
143 | /** | ||
90 | * @var bool | 144 | * @var bool |
91 | * | 145 | * |
92 | * @Exclude | 146 | * @Exclude |
@@ -171,7 +225,7 @@ class Entry | |||
171 | /** | 225 | /** |
172 | * @var string | 226 | * @var string |
173 | * | 227 | * |
174 | * @ORM\Column(name="language", type="text", nullable=true) | 228 | * @ORM\Column(name="language", type="string", length=20, nullable=true) |
175 | * | 229 | * |
176 | * @Groups({"entries_for_user", "export_all"}) | 230 | * @Groups({"entries_for_user", "export_all"}) |
177 | */ | 231 | */ |
@@ -245,15 +299,6 @@ class Entry | |||
245 | */ | 299 | */ |
246 | private $tags; | 300 | private $tags; |
247 | 301 | ||
248 | /** | ||
249 | * @var string | ||
250 | * | ||
251 | * @ORM\Column(name="origin_url", type="text", nullable=true) | ||
252 | * | ||
253 | * @Groups({"entries_for_user", "export_all"}) | ||
254 | */ | ||
255 | private $originUrl; | ||
256 | |||
257 | /* | 302 | /* |
258 | * @param User $user | 303 | * @param User $user |
259 | */ | 304 | */ |
@@ -307,6 +352,7 @@ class Entry | |||
307 | public function setUrl($url) | 352 | public function setUrl($url) |
308 | { | 353 | { |
309 | $this->url = $url; | 354 | $this->url = $url; |
355 | $this->hashedUrl = UrlHasher::hashUrl($url); | ||
310 | 356 | ||
311 | return $this; | 357 | return $this; |
312 | } | 358 | } |
@@ -336,6 +382,44 @@ class Entry | |||
336 | } | 382 | } |
337 | 383 | ||
338 | /** | 384 | /** |
385 | * update isArchived and archive_at fields. | ||
386 | * | ||
387 | * @param bool $isArchived | ||
388 | * | ||
389 | * @return Entry | ||
390 | */ | ||
391 | public function updateArchived($isArchived = false) | ||
392 | { | ||
393 | $this->setArchived($isArchived); | ||
394 | $this->setArchivedAt(null); | ||
395 | if ($this->isArchived()) { | ||
396 | $this->setArchivedAt(new \DateTime()); | ||
397 | } | ||
398 | |||
399 | return $this; | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * @return \DateTime|null | ||
404 | */ | ||
405 | public function getArchivedAt() | ||
406 | { | ||
407 | return $this->archivedAt; | ||
408 | } | ||
409 | |||
410 | /** | ||
411 | * @param \DateTime|null $archivedAt | ||
412 | * | ||
413 | * @return Entry | ||
414 | */ | ||
415 | public function setArchivedAt($archivedAt = null) | ||
416 | { | ||
417 | $this->archivedAt = $archivedAt; | ||
418 | |||
419 | return $this; | ||
420 | } | ||
421 | |||
422 | /** | ||
339 | * Get isArchived. | 423 | * Get isArchived. |
340 | * | 424 | * |
341 | * @return bool | 425 | * @return bool |
@@ -357,7 +441,7 @@ class Entry | |||
357 | 441 | ||
358 | public function toggleArchive() | 442 | public function toggleArchive() |
359 | { | 443 | { |
360 | $this->isArchived = $this->isArchived() ^ 1; | 444 | $this->updateArchived($this->isArchived() ^ 1); |
361 | 445 | ||
362 | return $this; | 446 | return $this; |
363 | } | 447 | } |
@@ -466,8 +550,6 @@ class Entry | |||
466 | * Set created_at. | 550 | * Set created_at. |
467 | * Only used when importing data from an other service. | 551 | * Only used when importing data from an other service. |
468 | * | 552 | * |
469 | * @param \DateTime $createdAt | ||
470 | * | ||
471 | * @return Entry | 553 | * @return Entry |
472 | */ | 554 | */ |
473 | public function setCreatedAt(\DateTime $createdAt) | 555 | public function setCreatedAt(\DateTime $createdAt) |
@@ -539,9 +621,6 @@ class Entry | |||
539 | return $this->annotations; | 621 | return $this->annotations; |
540 | } | 622 | } |
541 | 623 | ||
542 | /** | ||
543 | * @param Annotation $annotation | ||
544 | */ | ||
545 | public function setAnnotation(Annotation $annotation) | 624 | public function setAnnotation(Annotation $annotation) |
546 | { | 625 | { |
547 | $this->annotations[] = $annotation; | 626 | $this->annotations[] = $annotation; |
@@ -618,9 +697,6 @@ class Entry | |||
618 | return $data; | 697 | return $data; |
619 | } | 698 | } |
620 | 699 | ||
621 | /** | ||
622 | * @param Tag $tag | ||
623 | */ | ||
624 | public function addTag(Tag $tag) | 700 | public function addTag(Tag $tag) |
625 | { | 701 | { |
626 | if ($this->tags->contains($tag)) { | 702 | if ($this->tags->contains($tag)) { |
@@ -641,8 +717,6 @@ class Entry | |||
641 | 717 | ||
642 | /** | 718 | /** |
643 | * Remove the given tag from the entry (if the tag is associated). | 719 | * Remove the given tag from the entry (if the tag is associated). |
644 | * | ||
645 | * @param Tag $tag | ||
646 | */ | 720 | */ |
647 | public function removeTag(Tag $tag) | 721 | public function removeTag(Tag $tag) |
648 | { | 722 | { |
@@ -714,7 +788,20 @@ class Entry | |||
714 | } | 788 | } |
715 | 789 | ||
716 | /** | 790 | /** |
717 | * @return string | 791 | * Format the entry language to a valid html lang attribute. |
792 | */ | ||
793 | public function getHTMLLanguage() | ||
794 | { | ||
795 | $parsedLocale = \Locale::parseLocale($this->getLanguage()); | ||
796 | $lang = ''; | ||
797 | $lang .= $parsedLocale['language'] ?? ''; | ||
798 | $lang .= isset($parsedLocale['region']) ? '-' . $parsedLocale['region'] : ''; | ||
799 | |||
800 | return $lang; | ||
801 | } | ||
802 | |||
803 | /** | ||
804 | * @return string|null | ||
718 | */ | 805 | */ |
719 | public function getUid() | 806 | public function getUid() |
720 | { | 807 | { |
@@ -790,8 +877,6 @@ class Entry | |||
790 | } | 877 | } |
791 | 878 | ||
792 | /** | 879 | /** |
793 | * @param \Datetime $publishedAt | ||
794 | * | ||
795 | * @return Entry | 880 | * @return Entry |
796 | */ | 881 | */ |
797 | public function setPublishedAt(\Datetime $publishedAt) | 882 | public function setPublishedAt(\Datetime $publishedAt) |
@@ -864,4 +949,49 @@ class Entry | |||
864 | { | 949 | { |
865 | return $this->originUrl; | 950 | return $this->originUrl; |
866 | } | 951 | } |
952 | |||
953 | /** | ||
954 | * Set given url. | ||
955 | * | ||
956 | * @param string $givenUrl | ||
957 | * | ||
958 | * @return Entry | ||
959 | */ | ||
960 | public function setGivenUrl($givenUrl) | ||
961 | { | ||
962 | $this->givenUrl = $givenUrl; | ||
963 | $this->hashedGivenUrl = UrlHasher::hashUrl($givenUrl); | ||
964 | |||
965 | return $this; | ||
966 | } | ||
967 | |||
968 | /** | ||
969 | * Get given url. | ||
970 | * | ||
971 | * @return string | ||
972 | */ | ||
973 | public function getGivenUrl() | ||
974 | { | ||
975 | return $this->givenUrl; | ||
976 | } | ||
977 | |||
978 | /** | ||
979 | * @return string | ||
980 | */ | ||
981 | public function getHashedUrl() | ||
982 | { | ||
983 | return $this->hashedUrl; | ||
984 | } | ||
985 | |||
986 | /** | ||
987 | * @param mixed $hashedUrl | ||
988 | * | ||
989 | * @return Entry | ||
990 | */ | ||
991 | public function setHashedUrl($hashedUrl) | ||
992 | { | ||
993 | $this->hashedUrl = $hashedUrl; | ||
994 | |||
995 | return $this; | ||
996 | } | ||
867 | } | 997 | } |
diff --git a/src/Wallabag/CoreBundle/Entity/InternalSetting.php b/src/Wallabag/CoreBundle/Entity/InternalSetting.php new file mode 100644 index 00000000..df8bd3be --- /dev/null +++ b/src/Wallabag/CoreBundle/Entity/InternalSetting.php | |||
@@ -0,0 +1,36 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Entity; | ||
4 | |||
5 | use Craue\ConfigBundle\Entity\BaseSetting; | ||
6 | use Doctrine\ORM\Mapping as ORM; | ||
7 | |||
8 | /** | ||
9 | * InternalSetting. | ||
10 | * | ||
11 | * Re-define setting so we can override length attribute to fix utf8mb4 issue. | ||
12 | * | ||
13 | * @ORM\Entity(repositoryClass="Craue\ConfigBundle\Repository\SettingRepository") | ||
14 | * @ORM\Table(name="`internal_setting`") | ||
15 | * @ORM\AttributeOverrides({ | ||
16 | * @ORM\AttributeOverride(name="name", | ||
17 | * column=@ORM\Column( | ||
18 | * length = 191 | ||
19 | * ) | ||
20 | * ), | ||
21 | * @ORM\AttributeOverride(name="section", | ||
22 | * column=@ORM\Column( | ||
23 | * length = 191 | ||
24 | * ) | ||
25 | * ) | ||
26 | * }) | ||
27 | */ | ||
28 | class InternalSetting extends BaseSetting | ||
29 | { | ||
30 | /** | ||
31 | * @var string|null | ||
32 | * | ||
33 | * @ORM\Column(name="value", type="string", nullable=true, length=191) | ||
34 | */ | ||
35 | protected $value; | ||
36 | } | ||
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/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index a6dc8c50..9fb2f94f 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php | |||
@@ -13,7 +13,13 @@ use JMS\Serializer\Annotation\XmlRoot; | |||
13 | * Tag. | 13 | * Tag. |
14 | * | 14 | * |
15 | * @XmlRoot("tag") | 15 | * @XmlRoot("tag") |
16 | * @ORM\Table(name="`tag`") | 16 | * @ORM\Table( |
17 | * name="`tag`", | ||
18 | * options={"collate"="utf8mb4_bin", "charset"="utf8mb4"}, | ||
19 | * indexes={ | ||
20 | * @ORM\Index(name="tag_label", columns={"label"}, options={"lengths"={255}}), | ||
21 | * } | ||
22 | * ) | ||
17 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TagRepository") | 23 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TagRepository") |
18 | * @ExclusionPolicy("all") | 24 | * @ExclusionPolicy("all") |
19 | */ | 25 | */ |
@@ -98,9 +104,6 @@ class Tag | |||
98 | return $this->slug; | 104 | return $this->slug; |
99 | } | 105 | } |
100 | 106 | ||
101 | /** | ||
102 | * @param Entry $entry | ||
103 | */ | ||
104 | public function addEntry(Entry $entry) | 107 | public function addEntry(Entry $entry) |
105 | { | 108 | { |
106 | if ($this->entries->contains($entry)) { | 109 | if ($this->entries->contains($entry)) { |
@@ -111,9 +114,6 @@ class Tag | |||
111 | $entry->addTag($this); | 114 | $entry->addTag($this); |
112 | } | 115 | } |
113 | 116 | ||
114 | /** | ||
115 | * @param Entry $entry | ||
116 | */ | ||
117 | public function removeEntry(Entry $entry) | 117 | public function removeEntry(Entry $entry) |
118 | { | 118 | { |
119 | if (!$this->entries->contains($entry)) { | 119 | if (!$this->entries->contains($entry)) { |
diff --git a/src/Wallabag/CoreBundle/Entity/TaggingRule.php b/src/Wallabag/CoreBundle/Entity/TaggingRule.php index 84e11e26..f7166087 100644 --- a/src/Wallabag/CoreBundle/Entity/TaggingRule.php +++ b/src/Wallabag/CoreBundle/Entity/TaggingRule.php | |||
@@ -3,12 +3,16 @@ | |||
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 JMS\Serializer\Annotation\Exclude; |
7 | use JMS\Serializer\Annotation\Groups; | ||
8 | use JMS\Serializer\Annotation\XmlRoot; | ||
9 | use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert; | ||
7 | use Symfony\Component\Validator\Constraints as Assert; | 10 | use Symfony\Component\Validator\Constraints as Assert; |
8 | 11 | ||
9 | /** | 12 | /** |
10 | * Tagging rule. | 13 | * Tagging rule. |
11 | * | 14 | * |
15 | * @XmlRoot("tagging_rule") | ||
12 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TaggingRuleRepository") | 16 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TaggingRuleRepository") |
13 | * @ORM\Table(name="`tagging_rule`") | 17 | * @ORM\Table(name="`tagging_rule`") |
14 | * @ORM\Entity | 18 | * @ORM\Entity |
@@ -34,6 +38,8 @@ class TaggingRule | |||
34 | * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches", "notmatches"} | 38 | * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches", "notmatches"} |
35 | * ) | 39 | * ) |
36 | * @ORM\Column(name="rule", type="string", nullable=false) | 40 | * @ORM\Column(name="rule", type="string", nullable=false) |
41 | * | ||
42 | * @Groups({"export_tagging_rule"}) | ||
37 | */ | 43 | */ |
38 | private $rule; | 44 | private $rule; |
39 | 45 | ||
@@ -42,10 +48,14 @@ class TaggingRule | |||
42 | * | 48 | * |
43 | * @Assert\NotBlank() | 49 | * @Assert\NotBlank() |
44 | * @ORM\Column(name="tags", type="simple_array", nullable=false) | 50 | * @ORM\Column(name="tags", type="simple_array", nullable=false) |
51 | * | ||
52 | * @Groups({"export_tagging_rule"}) | ||
45 | */ | 53 | */ |
46 | private $tags = []; | 54 | private $tags = []; |
47 | 55 | ||
48 | /** | 56 | /** |
57 | * @Exclude | ||
58 | * | ||
49 | * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Config", inversedBy="taggingRules") | 59 | * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Config", inversedBy="taggingRules") |
50 | */ | 60 | */ |
51 | private $config; | 61 | private $config; |
@@ -111,8 +121,6 @@ class TaggingRule | |||
111 | /** | 121 | /** |
112 | * Set config. | 122 | * Set config. |
113 | * | 123 | * |
114 | * @param Config $config | ||
115 | * | ||
116 | * @return TaggingRule | 124 | * @return TaggingRule |
117 | */ | 125 | */ |
118 | public function setConfig(Config $config) | 126 | public function setConfig(Config $config) |