]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #2401 from wallabag/reset-account
authorJeremy Benoist <j0k3r@users.noreply.github.com>
Mon, 24 Oct 2016 09:57:51 +0000 (11:57 +0200)
committerGitHub <noreply@github.com>
Mon, 24 Oct 2016 09:57:51 +0000 (11:57 +0200)
Reset account

1  2 
src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php

index 8cccffba1366bb51c46f68de2bcec354c2b3a616,52989bcf8a780df11bacedf19dc3edea80438566..8d3f07eef350f2eb8ebf12a05b80deb5f6d026fb
@@@ -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()
          ;
      }
  
              ->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();
+     }
  }