]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
Add custom doctrine subscriber for SQLite
[github/wallabag/wallabag.git] / src / Wallabag / AnnotationBundle / Repository / AnnotationRepository.php
index 5f7da70ecfa4cb1d375fdbc94f68d9a019c2c4ce..d999dc0f3c756bc85db536930f5666d6c5c011e4 100644 (file)
@@ -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();
+    }
 }