aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOlivier Mehani <shtrom@ssji.net>2019-05-03 22:23:04 +1000
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-05-24 15:17:46 +0200
commitd5744bf0dfdbee4dbbe380d8a076d07b89fc76e6 (patch)
treeef4e8eab0cd1eefd44ebcc2d0b2bbb347053c9cd
parent31e276fc1636b41b03b7c29127681de257c16b06 (diff)
downloadwallabag-d5744bf0dfdbee4dbbe380d8a076d07b89fc76e6.tar.gz
wallabag-d5744bf0dfdbee4dbbe380d8a076d07b89fc76e6.tar.zst
wallabag-d5744bf0dfdbee4dbbe380d8a076d07b89fc76e6.zip
Delegate findByUrlAndUserId to findByHashedUrlAndUserId
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 3990932e..960b682d 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -348,17 +348,9 @@ class EntryRepository extends EntityRepository
348 */ 348 */
349 public function findByUrlAndUserId($url, $userId) 349 public function findByUrlAndUserId($url, $userId)
350 { 350 {
351 $res = $this->createQueryBuilder('e') 351 return $this->findByHashedUrlAndUserId(
352 ->where('e.url = :url')->setParameter('url', urldecode($url)) 352 hash('sha1', $url), // XXX: the hash logic would better be in a separate util to avoid duplication with GenerateUrlHashesCommand::generateHashedUrls
353 ->andWhere('e.user = :user_id')->setParameter('user_id', $userId) 353 $userId);
354 ->getQuery()
355 ->getResult();
356
357 if (\count($res)) {
358 return current($res);
359 }
360
361 return false;
362 } 354 }
363 355
364 /** 356 /**