From d09fe4d233477d5cb9bfc613799b05a7ca14e270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 5 May 2017 14:33:36 +0200 Subject: Added test for deduplication --- .../CoreBundle/Repository/EntryRepository.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/Wallabag/CoreBundle/Repository') diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 5e7b0d3a..2e03fa19 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -392,4 +392,23 @@ class EntryRepository extends EntityRepository return $qb->getQuery()->getArrayResult(); } + + /** + * Find all entries by url and owner. + * + * @param $url + * @param $userId + * + * @return array + */ + public function findAllByUrlAndUserId($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(); + + return $res; + } } -- cgit v1.2.3