From 4c8dfe335a27c222fd37e4c2fb3c94d0b0bf8a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 30 Apr 2020 17:15:08 +0200 Subject: Fixed repository to retrieve articles --- src/Wallabag/CoreBundle/Controller/ExportController.php | 2 +- src/Wallabag/CoreBundle/Repository/EntryRepository.php | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index cec8d499..824d21bb 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php @@ -47,7 +47,7 @@ class ExportController extends Controller * * @Route("/export/{category}.{format}", name="export_entries", requirements={ * "format": "epub|mobi|pdf|json|xml|txt|csv", - * "category": "all|unread|starred|archive|tag_entries|untagged|search" + * "category": "all|unread|starred|archive|tag_entries|untagged|search|same_domain" * }) * * @return \Symfony\Component\HttpFoundation\Response diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index f2c73bbf..23d1e37e 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -52,14 +52,21 @@ class EntryRepository extends EntityRepository */ public function getBuilderForSameDomainByUser($userId, $entryId) { - dump($entryId);die; - - $ + $queryBuilder = $this->createQueryBuilder('e'); return $this ->getSortedQueryBuilderByUser($userId) - ->andWhere('e.isArchived = false') - ; + ->andWhere('e.id <> :entryId')->setParameter('entryId', $entryId) + ->andWhere( + $queryBuilder->expr()->in( + 'e.domainName', + $this + ->createQueryBuilder('e2') + ->select('e2.domainName') + ->where('e2.id = :entryId')->setParameter('entryId', $entryId) + ->getDQL() + ) + ); } /** -- cgit v1.2.3