diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-03-12 11:10:21 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-03-12 11:10:21 +0100 |
commit | 6ab56c7b2c225b74b000e9ecedfe28aa0f8d1e18 (patch) | |
tree | cfb8e6887628780ba7a571565f561f00019a0e0b /src/Wallabag/AnnotationBundle/Repository | |
parent | 55e61971f393d679a47e18f48cd2e04403ce4368 (diff) | |
parent | b95ffda2a105af4c6f4f86aca025a0bf967bc86a (diff) | |
download | wallabag-6ab56c7b2c225b74b000e9ecedfe28aa0f8d1e18.tar.gz wallabag-6ab56c7b2c225b74b000e9ecedfe28aa0f8d1e18.tar.zst wallabag-6ab56c7b2c225b74b000e9ecedfe28aa0f8d1e18.zip |
Merge pull request #1775 from wallabag/v2-few-fixes
Some fixes
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 | } |