aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-04-01 11:50:33 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-04-01 13:24:40 +0200
commit9c2b2aae70b06411336e6eb6ac43b3ebd30dc38c (patch)
treeb8b37a0f8b3edd0c4db1678815d906a7b6126f31 /src/Wallabag/CoreBundle/Repository
parentbfe02a0b481055bb4e799200c8daa9a0ad987c71 (diff)
downloadwallabag-9c2b2aae70b06411336e6eb6ac43b3ebd30dc38c.tar.gz
wallabag-9c2b2aae70b06411336e6eb6ac43b3ebd30dc38c.tar.zst
wallabag-9c2b2aae70b06411336e6eb6ac43b3ebd30dc38c.zip
Keep url in exists endpoint
- Add migration - Use md5 instead of sha512 (we don't need security here, just a hash) - Update tests
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 45366623..0c175abb 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -347,6 +347,30 @@ class EntryRepository extends EntityRepository
347 } 347 }
348 348
349 /** 349 /**
350 * Find an entry by its hashed url and its owner.
351 * If it exists, return the entry otherwise return false.
352 *
353 * @param $hashedUrl
354 * @param $userId
355 *
356 * @return Entry|bool
357 */
358 public function findByHashedUrlAndUserId($hashedUrl, $userId)
359 {
360 $res = $this->createQueryBuilder('e')
361 ->where('e.hashedUrl = :hashed_url')->setParameter('hashed_url', urldecode($hashedUrl))
362 ->andWhere('e.user = :user_id')->setParameter('user_id', $userId)
363 ->getQuery()
364 ->getResult();
365
366 if (\count($res)) {
367 return current($res);
368 }
369
370 return false;
371 }
372
373 /**
350 * Count all entries for a user. 374 * Count all entries for a user.
351 * 375 *
352 * @param int $userId 376 * @param int $userId