diff options
Diffstat (limited to 'src/Wallabag/AnnotationBundle/Repository')
-rw-r--r-- | src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index c1c6e638..7f35373f 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | |||
@@ -88,4 +88,21 @@ class AnnotationRepository extends EntityRepository | |||
88 | ->getQuery() | 88 | ->getQuery() |
89 | ->getOneOrNullResult(); | 89 | ->getOneOrNullResult(); |
90 | } | 90 | } |
91 | |||
92 | /** | ||
93 | * Used only in test case to get the right annotation associated to the right user. | ||
94 | * | ||
95 | * @param string $username | ||
96 | * | ||
97 | * @return Annotation | ||
98 | */ | ||
99 | public function findOneByUsername($username) | ||
100 | { | ||
101 | return $this->createQueryBuilder('a') | ||
102 | ->leftJoin('a.user', 'u') | ||
103 | ->where('u.username = :username')->setParameter('username', $username) | ||
104 | ->setMaxResults(1) | ||
105 | ->getQuery() | ||
106 | ->getSingleResult(); | ||
107 | } | ||
91 | } | 108 | } |