aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/AnnotationBundle/Repository
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-10-01 14:01:13 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-22 13:13:07 +0200
commit191564b7f71d01fb4c597c9b9641e23db564278d (patch)
tree1cf81a2474d064f11663c70bd77121fc3c4c69a1 /src/Wallabag/AnnotationBundle/Repository
parent98efffc2a62820bad347a0f93840c48fa57f8cc3 (diff)
downloadwallabag-191564b7f71d01fb4c597c9b9641e23db564278d.tar.gz
wallabag-191564b7f71d01fb4c597c9b9641e23db564278d.tar.zst
wallabag-191564b7f71d01fb4c597c9b9641e23db564278d.zip
Add custom doctrine subscriber for SQLite
Since SQLite doesn’t handle cascade remove by default, we need to handle it manually. Also some refacto
Diffstat (limited to 'src/Wallabag/AnnotationBundle/Repository')
-rw-r--r--src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php13
1 files changed, 13 insertions, 0 deletions
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
106 ->getQuery() 106 ->getQuery()
107 ->getSingleResult(); 107 ->getSingleResult();
108 } 108 }
109
110 /**
111 * Remove all annotations for a user id.
112 * Used when a user want to reset all informations
113 *
114 * @param int $userId
115 */
116 public function removeAllByUserId($userId)
117 {
118 $this->getEntityManager()
119 ->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = '.$userId)
120 ->execute();
121 }
109} 122}