From 5c072d2b57b2b5f95b25411909ac8a6af2ef6ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 9 Jan 2016 14:34:49 +0100 Subject: Quickstart for beginners --- .../CoreBundle/Repository/EntryRepository.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php') 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 /** * Fetch an entry with a tag. Only used for tests. * + * @param int $userId + * * @return Entry */ public function findOneWithTags($userId) @@ -248,4 +250,21 @@ class EntryRepository extends EntityRepository return false; } + + /** + * Count all entries for a user. + * + * @param int $userId + * + * @return integer + */ + public function countAllEntriesByUsername($userId) + { + $qb = $this->createQueryBuilder('e') + ->select('count(e)') + ->where('e.user=:userId')->setParameter('userId', $userId) + ; + + return $qb->getQuery()->getSingleScalarResult(); + } } -- cgit v1.2.3