aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity/Entry.php
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-06-05 11:38:00 +0200
committerGitHub <noreply@github.com>2019-06-05 11:38:00 +0200
commit16e1c07553d276f6a4df8fb0f2d1aa25026d73be (patch)
tree30771618e781968dbbc79fa7113db266017a35ae /src/Wallabag/CoreBundle/Entity/Entry.php
parent8671da5eadc93204f2742bb6b2b5b8fc1eddf131 (diff)
parentd8809f70ea3a2f88635827b37af23b2fc2a93db6 (diff)
downloadwallabag-16e1c07553d276f6a4df8fb0f2d1aa25026d73be.tar.gz
wallabag-16e1c07553d276f6a4df8fb0f2d1aa25026d73be.tar.zst
wallabag-16e1c07553d276f6a4df8fb0f2d1aa25026d73be.zip
Merge pull request #3271 from wallabag/store-resolved-url
Add `given_url` in Entry table to check if a redirected url has already added
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php')
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php68
1 files changed, 58 insertions, 10 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index 8637c62f..4d5e6fc9 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -27,7 +27,8 @@ use Wallabag\UserBundle\Entity\User;
27 * indexes={ 27 * indexes={
28 * @ORM\Index(name="created_at", columns={"created_at"}), 28 * @ORM\Index(name="created_at", columns={"created_at"}),
29 * @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}}) 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}})
31 * } 32 * }
32 * ) 33 * )
33 * @ORM\HasLifecycleCallbacks() 34 * @ORM\HasLifecycleCallbacks()
@@ -68,6 +69,8 @@ class Entry
68 private $title; 69 private $title;
69 70
70 /** 71 /**
72 * Define the url fetched by wallabag (the final url after potential redirections).
73 *
71 * @var string 74 * @var string
72 * 75 *
73 * @Assert\NotBlank() 76 * @Assert\NotBlank()
@@ -85,6 +88,35 @@ class Entry
85 private $hashedUrl; 88 private $hashedUrl;
86 89
87 /** 90 /**
91 * From where user retrieved/found the url (an other article, a twitter, or the given_url if non are provided).
92 *
93 * @var string
94 *
95 * @ORM\Column(name="origin_url", type="text", nullable=true)
96 *
97 * @Groups({"entries_for_user", "export_all"})
98 */
99 private $originUrl;
100
101 /**
102 * Define the url entered by the user (without redirections).
103 *
104 * @var string
105 *
106 * @ORM\Column(name="given_url", type="text", nullable=true)
107 *
108 * @Groups({"entries_for_user", "export_all"})
109 */
110 private $givenUrl;
111
112 /**
113 * @var string
114 *
115 * @ORM\Column(name="hashed_given_url", type="string", length=40, nullable=true)
116 */
117 private $hashedGivenUrl;
118
119 /**
88 * @var bool 120 * @var bool
89 * 121 *
90 * @Exclude 122 * @Exclude
@@ -263,15 +295,6 @@ class Entry
263 */ 295 */
264 private $tags; 296 private $tags;
265 297
266 /**
267 * @var string
268 *
269 * @ORM\Column(name="origin_url", type="text", nullable=true)
270 *
271 * @Groups({"entries_for_user", "export_all"})
272 */
273 private $originUrl;
274
275 /* 298 /*
276 * @param User $user 299 * @param User $user
277 */ 300 */
@@ -923,6 +946,31 @@ class Entry
923 } 946 }
924 947
925 /** 948 /**
949 * Set given url.
950 *
951 * @param string $givenUrl
952 *
953 * @return Entry
954 */
955 public function setGivenUrl($givenUrl)
956 {
957 $this->givenUrl = $givenUrl;
958 $this->hashedGivenUrl = UrlHasher::hashUrl($givenUrl);
959
960 return $this;
961 }
962
963 /**
964 * Get given url.
965 *
966 * @return string
967 */
968 public function getGivenUrl()
969 {
970 return $this->givenUrl;
971 }
972
973 /**
926 * @return string 974 * @return string
927 */ 975 */
928 public function getHashedUrl() 976 public function getHashedUrl()