X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FRepository%2FEntryRepository.php;h=38a3026d436dc370169e106cda0d06c8bdc43c67;hb=2a1ceb67b4400f46f4d3067e887ff54aa906f0a2;hp=47db4c079b83decc68e9b29b3cc0213838e0bf47;hpb=33264c2d02fdfe6e8321096491b9c7398cd10e9a;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 47db4c07..38a3026d 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -151,7 +151,7 @@ class EntryRepository extends EntityRepository $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; @@ -320,7 +320,7 @@ class EntryRepository extends EntityRepository ->getQuery() ->getResult(); - if (count($res)) { + if (\count($res)) { return current($res); } @@ -344,26 +344,6 @@ class EntryRepository extends EntityRepository 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.