]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fixed repository to retrieve articles same-domain 4371/head
authorNicolas Lœuillet <nicolas@loeuillet.org>
Thu, 30 Apr 2020 15:15:08 +0000 (17:15 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Thu, 30 Apr 2020 15:15:08 +0000 (17:15 +0200)
src/Wallabag/CoreBundle/Controller/ExportController.php
src/Wallabag/CoreBundle/Repository/EntryRepository.php

index cec8d4999a621032cb3b6748ac30fe188a5d180c..824d21bb9fd1b54fe802786e333a58de35c910f4 100644 (file)
@@ -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
index f2c73bbfffcdfbd99ee629e1cf449fde626f67ba..23d1e37e2deda7aa25a53823a417ece9741edf5f 100644 (file)
@@ -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()
+                )
+            );
     }
 
     /**