From: Jeremy Benoist Date: Mon, 24 Oct 2016 09:57:51 +0000 (+0200) Subject: Merge pull request #2401 from wallabag/reset-account X-Git-Tag: 2.2.0~3^2~84 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;ds=sidebyside;h=9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5;hp=-c;p=github%2Fwallabag%2Fwallabag.git Merge pull request #2401 from wallabag/reset-account Reset account --- 9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5 diff --combined src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index 8cccffba,52989bcf..8d3f07ee --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php @@@ -50,8 -50,7 +50,8 @@@ class AnnotationRepository extends Enti { return $this->createQueryBuilder('a') ->andWhere('a.id = :annotationId')->setParameter('annotationId', $annotationId) - ->getQuery()->getSingleResult() + ->getQuery() + ->getSingleResult() ; } @@@ -68,8 -67,7 +68,8 @@@ return $this->createQueryBuilder('a') ->where('a.entry = :entryId')->setParameter('entryId', $entryId) ->andwhere('a.user = :userId')->setParameter('userId', $userId) - ->getQuery()->getResult() + ->getQuery() + ->getResult() ; } @@@ -108,4 -106,18 +108,18 @@@ ->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') + ->setParameter('userId', $userId) + ->execute(); + } }