diff options
Diffstat (limited to 'src/Wallabag/AnnotationBundle/Repository')
-rw-r--r-- | src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index c1c6e638..5f7da70e 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | |||
@@ -88,4 +88,22 @@ 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 | ->orderBy('a.id', 'DESC') | ||
105 | ->setMaxResults(1) | ||
106 | ->getQuery() | ||
107 | ->getSingleResult(); | ||
108 | } | ||
91 | } | 109 | } |