aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 6972e974..9bda4e15 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -135,6 +135,7 @@ class EntryRepository extends EntityRepository
135 * @param int $userId 135 * @param int $userId
136 * @param bool $isArchived 136 * @param bool $isArchived
137 * @param bool $isStarred 137 * @param bool $isStarred
138 * @param bool $isPublic
138 * @param string $sort 139 * @param string $sort
139 * @param string $order 140 * @param string $order
140 * @param int $since 141 * @param int $since
@@ -142,18 +143,22 @@ class EntryRepository extends EntityRepository
142 * 143 *
143 * @return array 144 * @return array
144 */ 145 */
145 public function findEntries($userId, $isArchived = null, $isStarred = null, $sort = 'created', $order = 'ASC', $since = 0, $tags = '') 146 public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'ASC', $since = 0, $tags = '')
146 { 147 {
147 $qb = $this->createQueryBuilder('e') 148 $qb = $this->createQueryBuilder('e')
148 ->leftJoin('e.tags', 't') 149 ->leftJoin('e.tags', 't')
149 ->where('e.user =:userId')->setParameter('userId', $userId); 150 ->where('e.user =:userId')->setParameter('userId', $userId);
150 151
151 if (null !== $isArchived) { 152 if (null !== $isArchived) {
152 $qb->andWhere('e.isArchived =:isArchived')->setParameter('isArchived', (bool) $isArchived); 153 $qb->andWhere('e.isArchived = :isArchived')->setParameter('isArchived', (bool) $isArchived);
153 } 154 }
154 155
155 if (null !== $isStarred) { 156 if (null !== $isStarred) {
156 $qb->andWhere('e.isStarred =:isStarred')->setParameter('isStarred', (bool) $isStarred); 157 $qb->andWhere('e.isStarred = :isStarred')->setParameter('isStarred', (bool) $isStarred);
158 }
159
160 if (null !== $isPublic) {
161 $qb->andWhere('e.uid IS '.(true === $isPublic ? 'NOT' : '').' NULL');
157 } 162 }
158 163
159 if ($since > 0) { 164 if ($since > 0) {