]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/WallabagBundle/Repository/EntriesRepository.php
article view, fav list, archive list
[github/wallabag/wallabag.git] / src / WallabagBundle / Repository / EntriesRepository.php
index 4c13c9c2fd65f07fa6b104207a3f990714e556a8..c355a012c61dd51a68ccc0a1e914f4d9468e3a42 100644 (file)
@@ -13,14 +13,6 @@ use Doctrine\ORM\EntityRepository;
  */
 class EntriesRepository extends EntityRepository
 {
-  /*  public function findUnreadByUser($userId)
-    {
-        return $this->createQueryBuilder('e')
-            ->where('e.is_read = 0')
-            ->andWhere('e.user_id = :userId')
-            ->setParameter('userId', $userId)
-            ->getQuery();
-    }*/
     public function findUnreadByUser($userId)
     {
         $qb = $this->createQueryBuilder('e')
@@ -32,4 +24,28 @@ class EntriesRepository extends EntityRepository
 
         return $qb;
     }
+
+    public function findArchiveByUser($userId)
+    {
+        $qb = $this->createQueryBuilder('e')
+            ->select('e')
+            ->where('e.isRead = 1')
+            ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
+            ->getQuery()
+            ->getResult(Query::HYDRATE_ARRAY);
+
+        return $qb;
+    }
+
+    public function findStarredByUser($userId)
+    {
+        $qb = $this->createQueryBuilder('e')
+            ->select('e')
+            ->where('e.isFav = 1')
+            ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
+            ->getQuery()
+            ->getResult(Query::HYDRATE_ARRAY);
+
+        return $qb;
+    }
 }