diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2017-07-10 21:32:25 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-05-29 13:50:59 +0200 |
commit | b7fa51ae7dd5fef2d9459100c88479413ddd3fb3 (patch) | |
tree | 0395f1ada65ba54578ab13b8c2398592b65bd6a1 /src/Wallabag/CoreBundle/Entity | |
parent | e9579d6de9ea99522e5905e8bb827e858c8da1fc (diff) | |
download | wallabag-b7fa51ae7dd5fef2d9459100c88479413ddd3fb3.tar.gz wallabag-b7fa51ae7dd5fef2d9459100c88479413ddd3fb3.tar.zst wallabag-b7fa51ae7dd5fef2d9459100c88479413ddd3fb3.zip |
Added given_url in entry table
- Added index on entry table for given_url field
- Fix tests:
The previous `bit.ly` url redirected to doc.wallabag but that url doesn't exist in the fixtures.
I used our own internal "redirector" to create a redirect to an url which exist in the fixtures.
Also, updating current migration to use the new `WallabagMigration`.
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 1b4367fd..62274136 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -28,7 +28,8 @@ use Wallabag\UserBundle\Entity\User; | |||
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 | * } | 31 | * }, |
32 | * uniqueConstraints={@ORM\UniqueConstraint(name="IDX_entry_given_url",columns={"url", "given_url", "user_id"})} | ||
32 | * ) | 33 | * ) |
33 | * @ORM\HasLifecycleCallbacks() | 34 | * @ORM\HasLifecycleCallbacks() |
34 | * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())") | 35 | * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())") |
@@ -70,6 +71,15 @@ class Entry | |||
70 | /** | 71 | /** |
71 | * @var string | 72 | * @var string |
72 | * | 73 | * |
74 | * @ORM\Column(name="given_url", type="text", nullable=true) | ||
75 | * | ||
76 | * @Groups({"entries_for_user", "export_all"}) | ||
77 | */ | ||
78 | private $givenUrl; | ||
79 | |||
80 | /** | ||
81 | * @var string | ||
82 | * | ||
73 | * @Assert\NotBlank() | 83 | * @Assert\NotBlank() |
74 | * @ORM\Column(name="url", type="text", nullable=true) | 84 | * @ORM\Column(name="url", type="text", nullable=true) |
75 | * | 85 | * |
@@ -316,6 +326,30 @@ class Entry | |||
316 | } | 326 | } |
317 | 327 | ||
318 | /** | 328 | /** |
329 | * Set given url. | ||
330 | * | ||
331 | * @param string $givenUrl | ||
332 | * | ||
333 | * @return Entry | ||
334 | */ | ||
335 | public function setGivenUrl($givenUrl) | ||
336 | { | ||
337 | $this->givenUrl = $givenUrl; | ||
338 | |||
339 | return $this; | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Get given Url. | ||
344 | * | ||
345 | * @return string | ||
346 | */ | ||
347 | public function getGivenUrl() | ||
348 | { | ||
349 | return $this->givenUrl; | ||
350 | } | ||
351 | |||
352 | /** | ||
319 | * Set url. | 353 | * Set url. |
320 | * | 354 | * |
321 | * @param string $url | 355 | * @param string $url |