diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-08 11:14:09 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-22 13:13:07 +0200 |
commit | 8c61fd12b1df50d481e9f82c39521cca7b8ad060 (patch) | |
tree | 877e849dda40dd7652ef650b1255c370c0627066 | |
parent | ca8b49f46e9e45875ef0f9dc88a8315489152e82 (diff) | |
download | wallabag-8c61fd12b1df50d481e9f82c39521cca7b8ad060.tar.gz wallabag-8c61fd12b1df50d481e9f82c39521cca7b8ad060.tar.zst wallabag-8c61fd12b1df50d481e9f82c39521cca7b8ad060.zip |
CS
4 files changed, 10 insertions, 9 deletions
diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index d999dc0f..c81a2614 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | |||
@@ -109,9 +109,9 @@ class AnnotationRepository extends EntityRepository | |||
109 | 109 | ||
110 | /** | 110 | /** |
111 | * Remove all annotations for a user id. | 111 | * Remove all annotations for a user id. |
112 | * Used when a user want to reset all informations | 112 | * Used when a user want to reset all informations. |
113 | * | 113 | * |
114 | * @param int $userId | 114 | * @param int $userId |
115 | */ | 115 | */ |
116 | public function removeAllByUserId($userId) | 116 | public function removeAllByUserId($userId) |
117 | { | 117 | { |
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index e2484064..8d391917 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -253,7 +253,7 @@ class ConfigController extends Controller | |||
253 | $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); | 253 | $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); |
254 | } | 254 | } |
255 | 255 | ||
256 | // manually remove tags first to avoid orphan tag | 256 | // manually remove tags to avoid orphan tag |
257 | $this->removeAllTagsByUserId($this->getUser()->getId()); | 257 | $this->removeAllTagsByUserId($this->getUser()->getId()); |
258 | 258 | ||
259 | $this->getDoctrine() | 259 | $this->getDoctrine() |
@@ -270,9 +270,9 @@ class ConfigController extends Controller | |||
270 | } | 270 | } |
271 | 271 | ||
272 | /** | 272 | /** |
273 | * Remove all tags for a given user and cleanup orphan tags | 273 | * Remove all tags for a given user and cleanup orphan tags. |
274 | * | 274 | * |
275 | * @param int $userId | 275 | * @param int $userId |
276 | */ | 276 | */ |
277 | private function removeAllTagsByUserId($userId) | 277 | private function removeAllTagsByUserId($userId) |
278 | { | 278 | { |
@@ -286,6 +286,7 @@ class ConfigController extends Controller | |||
286 | ->getRepository('WallabagCoreBundle:Entry') | 286 | ->getRepository('WallabagCoreBundle:Entry') |
287 | ->removeTags($userId, $tags); | 287 | ->removeTags($userId, $tags); |
288 | 288 | ||
289 | // cleanup orphan tags | ||
289 | $em = $this->getDoctrine()->getManager(); | 290 | $em = $this->getDoctrine()->getManager(); |
290 | 291 | ||
291 | foreach ($tags as $tag) { | 292 | foreach ($tags as $tag) { |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 8704a2a6..5df5eff5 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -332,9 +332,9 @@ class EntryRepository extends EntityRepository | |||
332 | 332 | ||
333 | /** | 333 | /** |
334 | * Remove all entries for a user id. | 334 | * Remove all entries for a user id. |
335 | * Used when a user want to reset all informations | 335 | * Used when a user want to reset all informations. |
336 | * | 336 | * |
337 | * @param int $userId | 337 | * @param int $userId |
338 | */ | 338 | */ |
339 | public function removeAllByUserId($userId) | 339 | public function removeAllByUserId($userId) |
340 | { | 340 | { |
diff --git a/src/Wallabag/CoreBundle/Subscriber/SQLiteCascadeDeleteSubscriber.php b/src/Wallabag/CoreBundle/Subscriber/SQLiteCascadeDeleteSubscriber.php index d5180577..f7210bd3 100644 --- a/src/Wallabag/CoreBundle/Subscriber/SQLiteCascadeDeleteSubscriber.php +++ b/src/Wallabag/CoreBundle/Subscriber/SQLiteCascadeDeleteSubscriber.php | |||
@@ -1,8 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
2 | namespace Wallabag\CoreBundle\Subscriber; | 3 | namespace Wallabag\CoreBundle\Subscriber; |
3 | 4 | ||
4 | use Doctrine\Common\EventSubscriber; | 5 | use Doctrine\Common\EventSubscriber; |
5 | use Doctrine\ORM\EntityManager; | ||
6 | use Doctrine\ORM\Event\LifecycleEventArgs; | 6 | use Doctrine\ORM\Event\LifecycleEventArgs; |
7 | use Wallabag\CoreBundle\Entity\Entry; | 7 | use Wallabag\CoreBundle\Entity\Entry; |
8 | use Doctrine\Bundle\DoctrineBundle\Registry; | 8 | use Doctrine\Bundle\DoctrineBundle\Registry; |
@@ -38,7 +38,7 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber | |||
38 | 38 | ||
39 | /** | 39 | /** |
40 | * We removed everything related to the upcoming removed entry because SQLite can't handle it on it own. | 40 | * We removed everything related to the upcoming removed entry because SQLite can't handle it on it own. |
41 | * We do it in the preRemove, because we can't retrieve tags in the postRemove (because the entry id is gone) | 41 | * We do it in the preRemove, because we can't retrieve tags in the postRemove (because the entry id is gone). |
42 | * | 42 | * |
43 | * @param LifecycleEventArgs $args | 43 | * @param LifecycleEventArgs $args |
44 | */ | 44 | */ |