]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Repository/TagRepository.php
remove tag from entry #1377
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Repository / TagRepository.php
index c4aeb5949f79fe76a69b8427300dfe625f283d4e..8d9cf85cef14677ff66077f8b057d62acc257257 100644 (file)
@@ -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 findOnebyEntryAndLabel($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();
+    }
 }