diff options
Diffstat (limited to 'src/Wallabag')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 1 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 33 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 5 |
3 files changed, 38 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index b7fdea27..3ac0f8a6 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -78,6 +78,7 @@ class EntryController extends Controller | |||
78 | return $this->redirect($this->generateUrl('view', ['id' => $existingEntry->getId()])); | 78 | return $this->redirect($this->generateUrl('view', ['id' => $existingEntry->getId()])); |
79 | } | 79 | } |
80 | 80 | ||
81 | $entry->setGivenUrl($entry->getUrl()); | ||
81 | $this->updateEntry($entry); | 82 | $this->updateEntry($entry); |
82 | 83 | ||
83 | $em = $this->getDoctrine()->getManager(); | 84 | $em = $this->getDoctrine()->getManager(); |
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 2b1f2e05..58ec51db 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -68,6 +68,15 @@ class Entry | |||
68 | /** | 68 | /** |
69 | * @var string | 69 | * @var string |
70 | * | 70 | * |
71 | * @ORM\Column(name="given_url", type="text", nullable=true) | ||
72 | * | ||
73 | * @Groups({"entries_for_user", "export_all"}) | ||
74 | */ | ||
75 | private $givenUrl; | ||
76 | |||
77 | /** | ||
78 | * @var string | ||
79 | * | ||
71 | * @Assert\NotBlank() | 80 | * @Assert\NotBlank() |
72 | * @ORM\Column(name="url", type="text", nullable=true) | 81 | * @ORM\Column(name="url", type="text", nullable=true) |
73 | * | 82 | * |
@@ -298,6 +307,30 @@ class Entry | |||
298 | } | 307 | } |
299 | 308 | ||
300 | /** | 309 | /** |
310 | * Set given url. | ||
311 | * | ||
312 | * @param string $givenUrl | ||
313 | * | ||
314 | * @return Entry | ||
315 | */ | ||
316 | public function setGivenUrl($givenUrl) | ||
317 | { | ||
318 | $this->givenUrl = $givenUrl; | ||
319 | |||
320 | return $this; | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * Get given Url. | ||
325 | * | ||
326 | * @return string | ||
327 | */ | ||
328 | public function getGivenUrl() | ||
329 | { | ||
330 | return $this->givenUrl; | ||
331 | } | ||
332 | |||
333 | /** | ||
301 | * Set url. | 334 | * Set url. |
302 | * | 335 | * |
303 | * @param string $url | 336 | * @param string $url |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index b5e35eff..9e471d3c 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -314,8 +314,11 @@ class EntryRepository extends EntityRepository | |||
314 | */ | 314 | */ |
315 | public function findByUrlAndUserId($url, $userId) | 315 | public function findByUrlAndUserId($url, $userId) |
316 | { | 316 | { |
317 | $url = urldecode($url); | ||
318 | |||
317 | $res = $this->createQueryBuilder('e') | 319 | $res = $this->createQueryBuilder('e') |
318 | ->where('e.url = :url')->setParameter('url', urldecode($url)) | 320 | ->where('e.url = :url')->setParameter('url', $url) |
321 | ->orWhere('e.givenUrl = :url')->setParameter('url', $url) | ||
319 | ->andWhere('e.user = :user_id')->setParameter('user_id', $userId) | 322 | ->andWhere('e.user = :user_id')->setParameter('user_id', $userId) |
320 | ->getQuery() | 323 | ->getQuery() |
321 | ->getResult(); | 324 | ->getResult(); |