3 namespace Wallabag\CoreBundle\Repository
;
5 use Doctrine\ORM\EntityRepository
;
7 class TagRepository
extends EntityRepository
10 * Return only the QueryBuilder to retrieve all tags for a given user.
14 * @return QueryBuilder
16 private function getQbForAllTags($userId)
18 return $this->createQueryBuilder('t')
19 ->leftJoin('t.entries', 'e')
20 ->where('e.user = :userId')->setParameter('userId', $userId);
30 public function findAllTags($userId)
32 return $this->getQbForAllTags($userId)
38 * Used only in test case to get a tag for our entry.
42 public function findOneByEntryAndTagLabel($entry, $label)
44 return $this->createQueryBuilder('t')
45 ->leftJoin('t.entries', 'e')
46 ->where('e.id = :entryId')->setParameter('entryId', $entry->getId())
47 ->andWhere('t.label = :label')->setParameter('label', $label)