X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FRepository%2FTagRepository.php;h=afeb985b30c272c9b9f76d84540b15eaf230f172;hb=f2e5fdc3666a2a6525b4202ab48df05efeebaf5c;hp=c4aeb5949f79fe76a69b8427300dfe625f283d4e;hpb=fc73222723c7a0c9b577805d3ef51eb96b124b92;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index c4aeb594..afeb985b 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php @@ -51,4 +51,20 @@ class TagRepository extends EntityRepository ->getQuery() ->getResult(); } + + /** + * Used only in test case to get a tag for our entry. + * + * @return Tag + */ + public function findOneByEntryAndTagLabel($entry, $label) + { + return $this->createQueryBuilder('t') + ->leftJoin('t.entries', 'e') + ->where('e.id = :entryId')->setParameter('entryId', $entry->getId()) + ->andWhere('t.label = :label')->setParameter('label', $label) + ->setMaxResults(1) + ->getQuery() + ->getSingleResult(); + } }