diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index b3cfdc4a..c3fb87d2 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -25,7 +25,8 @@ use Wallabag\UserBundle\Entity\User; | |||
25 | * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, | 25 | * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, |
26 | * indexes={ | 26 | * indexes={ |
27 | * @ORM\Index(name="created_at", columns={"created_at"}), | 27 | * @ORM\Index(name="created_at", columns={"created_at"}), |
28 | * @ORM\Index(name="uid", columns={"uid"}) | 28 | * @ORM\Index(name="uid", columns={"uid"}), |
29 | * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}) | ||
29 | * } | 30 | * } |
30 | * ) | 31 | * ) |
31 | * @ORM\HasLifecycleCallbacks() | 32 | * @ORM\HasLifecycleCallbacks() |
@@ -76,6 +77,13 @@ class Entry | |||
76 | private $url; | 77 | private $url; |
77 | 78 | ||
78 | /** | 79 | /** |
80 | * @var string | ||
81 | * | ||
82 | * @ORM\Column(name="hashed_url", type="string", length=40, nullable=true) | ||
83 | */ | ||
84 | private $hashedUrl; | ||
85 | |||
86 | /** | ||
79 | * @var bool | 87 | * @var bool |
80 | * | 88 | * |
81 | * @Exclude | 89 | * @Exclude |
@@ -316,6 +324,7 @@ class Entry | |||
316 | public function setUrl($url) | 324 | public function setUrl($url) |
317 | { | 325 | { |
318 | $this->url = $url; | 326 | $this->url = $url; |
327 | $this->hashedUrl = hash('sha1', $url); | ||
319 | 328 | ||
320 | return $this; | 329 | return $this; |
321 | } | 330 | } |
@@ -911,4 +920,24 @@ class Entry | |||
911 | { | 920 | { |
912 | return $this->originUrl; | 921 | return $this->originUrl; |
913 | } | 922 | } |
923 | |||
924 | /** | ||
925 | * @return string | ||
926 | */ | ||
927 | public function getHashedUrl() | ||
928 | { | ||
929 | return $this->hashedUrl; | ||
930 | } | ||
931 | |||
932 | /** | ||
933 | * @param mixed $hashedUrl | ||
934 | * | ||
935 | * @return Entry | ||
936 | */ | ||
937 | public function setHashedUrl($hashedUrl) | ||
938 | { | ||
939 | $this->hashedUrl = $hashedUrl; | ||
940 | |||
941 | return $this; | ||
942 | } | ||
914 | } | 943 | } |