$qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since)));
}
- if ('' !== $tags) {
+ if (\is_string($tags) && '' !== $tags) {
foreach (explode(',', $tags) as $i => $tag) {
$entryAlias = 'e' . $i;
$tagAlias = 't' . $i;
->getQuery()
->getResult();
- if (count($res)) {
+ if (\count($res)) {
return current($res);
}
return (int) $qb->getQuery()->getSingleScalarResult();
}
- /**
- * Count all entries for a tag and a user.
- *
- * @param int $userId
- * @param int $tagId
- *
- * @return int
- */
- public function countAllEntriesByUserIdAndTagId($userId, $tagId)
- {
- $qb = $this->createQueryBuilder('e')
- ->select('count(e.id)')
- ->leftJoin('e.tags', 't')
- ->where('e.user = :userId')->setParameter('userId', $userId)
- ->andWhere('t.id = :tagId')->setParameter('tagId', $tagId)
- ;
-
- return (int) $qb->getQuery()->getSingleScalarResult();
- }
-
/**
* Remove all entries for a user id.
* Used when a user want to reset all informations.