diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-01 14:01:13 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-22 13:13:07 +0200 |
commit | 191564b7f71d01fb4c597c9b9641e23db564278d (patch) | |
tree | 1cf81a2474d064f11663c70bd77121fc3c4c69a1 /src/Wallabag/CoreBundle/Repository/EntryRepository.php | |
parent | 98efffc2a62820bad347a0f93840c48fa57f8cc3 (diff) | |
download | wallabag-191564b7f71d01fb4c597c9b9641e23db564278d.tar.gz wallabag-191564b7f71d01fb4c597c9b9641e23db564278d.tar.zst wallabag-191564b7f71d01fb4c597c9b9641e23db564278d.zip |
Add custom doctrine subscriber for SQLite
Since SQLite doesn’t handle cascade remove by default, we need to handle it manually.
Also some refacto
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index cd2b47b9..8704a2a6 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -329,4 +329,17 @@ class EntryRepository extends EntityRepository | |||
329 | 329 | ||
330 | return $qb->getQuery()->getSingleScalarResult(); | 330 | return $qb->getQuery()->getSingleScalarResult(); |
331 | } | 331 | } |
332 | |||
333 | /** | ||
334 | * Remove all entries for a user id. | ||
335 | * Used when a user want to reset all informations | ||
336 | * | ||
337 | * @param int $userId | ||
338 | */ | ||
339 | public function removeAllByUserId($userId) | ||
340 | { | ||
341 | $this->getEntityManager() | ||
342 | ->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = '.$userId) | ||
343 | ->execute(); | ||
344 | } | ||
332 | } | 345 | } |