]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Repository/EntryRepository.php
Added route to list entries with annotations
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Repository / EntryRepository.php
index bfd079377ac783bdd4c2e0e2f84cb3f2e9d0496b..9f25ad4c030147bf5c241b26b5116f55fc0617ac 100644 (file)
@@ -115,6 +115,21 @@ class EntryRepository extends EntityRepository
         return $this->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId));
     }
 
+    /**
+     * Retrieve entries with annotations for a user.
+     *
+     * @param int $userId
+     *
+     * @return QueryBuilder
+     */
+    public function getBuilderForAnnotationsByUser($userId)
+    {
+        return $this
+            ->getSortedQueryBuilderByUser($userId)
+            ->innerJoin('e.annotations', 'a')
+            ;
+    }
+
     /**
      * Retrieve untagged entries for a user.
      *
@@ -520,6 +535,10 @@ class EntryRepository extends EntityRepository
                 $qb->leftJoin('e.tags', 't');
                 $qb->andWhere('t.id is null');
                 break;
+            case 'with_annotations':
+                $qb->leftJoin('e.annotations', 'a');
+                $qb->andWhere('a.id is not null');
+                break;
         }
 
         $ids = $qb->getQuery()->getArrayResult();