forked from wallabag/wallabag
CS
This commit is contained in:
@ -109,9 +109,9 @@ class AnnotationRepository extends EntityRepository
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all annotations for a user id.
|
* Remove all annotations for a user id.
|
||||||
* Used when a user want to reset all informations
|
* Used when a user want to reset all informations.
|
||||||
*
|
*
|
||||||
* @param int $userId
|
* @param int $userId
|
||||||
*/
|
*/
|
||||||
public function removeAllByUserId($userId)
|
public function removeAllByUserId($userId)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -253,7 +253,7 @@ class ConfigController extends Controller
|
|||||||
$this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId());
|
$this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// manually remove tags first to avoid orphan tag
|
// manually remove tags to avoid orphan tag
|
||||||
$this->removeAllTagsByUserId($this->getUser()->getId());
|
$this->removeAllTagsByUserId($this->getUser()->getId());
|
||||||
|
|
||||||
$this->getDoctrine()
|
$this->getDoctrine()
|
||||||
@ -270,9 +270,9 @@ class ConfigController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all tags for a given user and cleanup orphan tags
|
* Remove all tags for a given user and cleanup orphan tags.
|
||||||
*
|
*
|
||||||
* @param int $userId
|
* @param int $userId
|
||||||
*/
|
*/
|
||||||
private function removeAllTagsByUserId($userId)
|
private function removeAllTagsByUserId($userId)
|
||||||
{
|
{
|
||||||
@ -286,6 +286,7 @@ class ConfigController extends Controller
|
|||||||
->getRepository('WallabagCoreBundle:Entry')
|
->getRepository('WallabagCoreBundle:Entry')
|
||||||
->removeTags($userId, $tags);
|
->removeTags($userId, $tags);
|
||||||
|
|
||||||
|
// cleanup orphan tags
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
|
|||||||
@ -332,9 +332,9 @@ class EntryRepository extends EntityRepository
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all entries for a user id.
|
* Remove all entries for a user id.
|
||||||
* Used when a user want to reset all informations
|
* Used when a user want to reset all informations.
|
||||||
*
|
*
|
||||||
* @param int $userId
|
* @param int $userId
|
||||||
*/
|
*/
|
||||||
public function removeAllByUserId($userId)
|
public function removeAllByUserId($userId)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Wallabag\CoreBundle\Subscriber;
|
namespace Wallabag\CoreBundle\Subscriber;
|
||||||
|
|
||||||
use Doctrine\Common\EventSubscriber;
|
use Doctrine\Common\EventSubscriber;
|
||||||
use Doctrine\ORM\EntityManager;
|
|
||||||
use Doctrine\ORM\Event\LifecycleEventArgs;
|
use Doctrine\ORM\Event\LifecycleEventArgs;
|
||||||
use Wallabag\CoreBundle\Entity\Entry;
|
use Wallabag\CoreBundle\Entity\Entry;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||||
@ -38,7 +38,7 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* We removed everything related to the upcoming removed entry because SQLite can't handle it on it own.
|
* We removed everything related to the upcoming removed entry because SQLite can't handle it on it own.
|
||||||
* We do it in the preRemove, because we can't retrieve tags in the postRemove (because the entry id is gone)
|
* We do it in the preRemove, because we can't retrieve tags in the postRemove (because the entry id is gone).
|
||||||
*
|
*
|
||||||
* @param LifecycleEventArgs $args
|
* @param LifecycleEventArgs $args
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user