Quickstart for beginners

This commit is contained in:
Nicolas Lœuillet
2016-01-09 14:34:49 +01:00
committed by Nicolas Lœuillet
parent 0aafb8dfcb
commit 5c072d2b57
12 changed files with 227 additions and 15 deletions

View File

@ -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();
}
}