From: Nicolas LÅ“uillet Date: Thu, 30 Apr 2020 15:15:08 +0000 (+0200) Subject: Fixed repository to retrieve articles X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=4c8dfe335a27c222fd37e4c2fb3c94d0b0bf8a61;p=github%2Fwallabag%2Fwallabag.git Fixed repository to retrieve articles --- 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() + ) + ); } /**