diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-10-24 11:57:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 11:57:51 +0200 |
commit | 9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5 (patch) | |
tree | 659842576e853a536c67e7c74139a73853b6caf2 /src/Wallabag/AnnotationBundle | |
parent | a1c18418288a9521c980c96fd5defffc757a81c6 (diff) | |
parent | f623516e107c8146f87d815f033cecb5d812466a (diff) | |
download | wallabag-9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5.tar.gz wallabag-9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5.tar.zst wallabag-9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5.zip |
Merge pull request #2401 from wallabag/reset-account
Reset account
Diffstat (limited to 'src/Wallabag/AnnotationBundle')
-rw-r--r-- | src/Wallabag/AnnotationBundle/Entity/Annotation.php | 2 | ||||
-rw-r--r-- | src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/Wallabag/AnnotationBundle/Entity/Annotation.php b/src/Wallabag/AnnotationBundle/Entity/Annotation.php index c48d8731..0838f5aa 100644 --- a/src/Wallabag/AnnotationBundle/Entity/Annotation.php +++ b/src/Wallabag/AnnotationBundle/Entity/Annotation.php | |||
@@ -82,7 +82,7 @@ class Annotation | |||
82 | * @Exclude | 82 | * @Exclude |
83 | * | 83 | * |
84 | * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Entry", inversedBy="annotations") | 84 | * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Entry", inversedBy="annotations") |
85 | * @ORM\JoinColumn(name="entry_id", referencedColumnName="id") | 85 | * @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade") |
86 | */ | 86 | */ |
87 | private $entry; | 87 | private $entry; |
88 | 88 | ||
diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index 8cccffba..8d3f07ee 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | |||
@@ -108,4 +108,18 @@ class AnnotationRepository extends EntityRepository | |||
108 | ->getQuery() | 108 | ->getQuery() |
109 | ->getSingleResult(); | 109 | ->getSingleResult(); |
110 | } | 110 | } |
111 | |||
112 | /** | ||
113 | * Remove all annotations for a user id. | ||
114 | * Used when a user want to reset all informations. | ||
115 | * | ||
116 | * @param int $userId | ||
117 | */ | ||
118 | public function removeAllByUserId($userId) | ||
119 | { | ||
120 | $this->getEntityManager() | ||
121 | ->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = :userId') | ||
122 | ->setParameter('userId', $userId) | ||
123 | ->execute(); | ||
124 | } | ||
111 | } | 125 | } |