X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FRepository%2FEntryRepository.php;h=299b0b27612a476164452e4d64f1d49a5de7d3d2;hb=b7fa51ae7dd5fef2d9459100c88479413ddd3fb3;hp=3990932e14a1261dcf49b3b9283fc5ede0182caf;hpb=a2b5d67560341011e791b678422578ab8d6b1e3f;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 3990932e..299b0b27 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -9,6 +9,7 @@ use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Pagerfanta; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; +use Wallabag\CoreBundle\Helper\UrlHasher; class EntryRepository extends EntityRepository { @@ -348,17 +349,10 @@ class EntryRepository extends EntityRepository */ public function findByUrlAndUserId($url, $userId) { - $res = $this->createQueryBuilder('e') - ->where('e.url = :url')->setParameter('url', urldecode($url)) - ->andWhere('e.user = :user_id')->setParameter('user_id', $userId) - ->getQuery() - ->getResult(); - - if (\count($res)) { - return current($res); - } - - return false; + return $this->findByHashedUrlAndUserId( + UrlHasher::hashUrl($url), + $userId + ); } /** @@ -374,6 +368,7 @@ class EntryRepository extends EntityRepository { $res = $this->createQueryBuilder('e') ->where('e.hashedUrl = :hashed_url')->setParameter('hashed_url', $hashedUrl) + // ->orWhere('e.givenUrl = :url')->setParameter('url', $url) ->andWhere('e.user = :user_id')->setParameter('user_id', $userId) ->getQuery() ->getResult();