From 191564b7f71d01fb4c597c9b9641e23db564278d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Oct 2016 14:01:13 +0200 Subject: Add custom doctrine subscriber for SQLite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since SQLite doesn’t handle cascade remove by default, we need to handle it manually. Also some refacto --- .../AnnotationBundle/Repository/AnnotationRepository.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Wallabag/AnnotationBundle/Repository') diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index 5f7da70e..d999dc0f 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php @@ -106,4 +106,17 @@ class AnnotationRepository extends EntityRepository ->getQuery() ->getSingleResult(); } + + /** + * Remove all annotations for a user id. + * Used when a user want to reset all informations + * + * @param int $userId + */ + public function removeAllByUserId($userId) + { + $this->getEntityManager() + ->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = '.$userId) + ->execute(); + } } -- cgit v1.2.3 From 8c61fd12b1df50d481e9f82c39521cca7b8ad060 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 8 Oct 2016 11:14:09 +0200 Subject: CS --- src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/AnnotationBundle/Repository') diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index d999dc0f..c81a2614 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php @@ -109,9 +109,9 @@ class AnnotationRepository extends EntityRepository /** * Remove all annotations for a user id. - * Used when a user want to reset all informations + * Used when a user want to reset all informations. * - * @param int $userId + * @param int $userId */ public function removeAllByUserId($userId) { -- cgit v1.2.3 From b0de88f75dead50385e80e3897dc3913a971b91e Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 11 Oct 2016 21:45:43 +0200 Subject: Use statements & update translation --- src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/AnnotationBundle/Repository') diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index c81a2614..52989bcf 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php @@ -116,7 +116,8 @@ class AnnotationRepository extends EntityRepository public function removeAllByUserId($userId) { $this->getEntityManager() - ->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = '.$userId) + ->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = :userId') + ->setParameter('userId', $userId) ->execute(); } } -- cgit v1.2.3