diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index c6763a40..a16be9e0 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -122,6 +122,8 @@ class EntryRepository extends EntityRepository | |||
122 | /** | 122 | /** |
123 | * Fetch an entry with a tag. Only used for tests. | 123 | * Fetch an entry with a tag. Only used for tests. |
124 | * | 124 | * |
125 | * @param int $userId | ||
126 | * | ||
125 | * @return Entry | 127 | * @return Entry |
126 | */ | 128 | */ |
127 | public function findOneWithTags($userId) | 129 | public function findOneWithTags($userId) |
@@ -248,4 +250,21 @@ class EntryRepository extends EntityRepository | |||
248 | 250 | ||
249 | return false; | 251 | return false; |
250 | } | 252 | } |
253 | |||
254 | /** | ||
255 | * Count all entries for a user. | ||
256 | * | ||
257 | * @param int $userId | ||
258 | * | ||
259 | * @return integer | ||
260 | */ | ||
261 | public function countAllEntriesByUsername($userId) | ||
262 | { | ||
263 | $qb = $this->createQueryBuilder('e') | ||
264 | ->select('count(e)') | ||
265 | ->where('e.user=:userId')->setParameter('userId', $userId) | ||
266 | ; | ||
267 | |||
268 | return $qb->getQuery()->getSingleScalarResult(); | ||
269 | } | ||
251 | } | 270 | } |