diff options
author | dartcafe <github@dartcafe.de> | 2021-04-25 20:59:28 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2021-04-25 20:59:28 +0300 |
commit | 3ce91267c388804950f21005f3bd4163583e1776 (patch) | |
tree | fb9e17b0a64c26d12e7d11964e19592214fa7c7c /lib | |
parent | bf45a374b6d26bb53ea9dc1a91878c43a11b20dc (diff) |
delete via sql
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Cron/UserDeletedJob.php | 5 | ||||
-rw-r--r-- | lib/Db/PollMapper.php | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/Cron/UserDeletedJob.php b/lib/Cron/UserDeletedJob.php index 213b21df..5d0664a0 100644 --- a/lib/Cron/UserDeletedJob.php +++ b/lib/Cron/UserDeletedJob.php @@ -57,9 +57,6 @@ class UserDeletedJob extends QueuedJob { 'user' => $owner ]); - $polls = $this->pollMapper->findForMe($owner); - foreach ($polls as $poll) { - $this->pollService->delete($poll->getId()); - } + $this->pollMapper->deleteFromUser($owner); } } diff --git a/lib/Db/PollMapper.php b/lib/Db/PollMapper.php index c3f414c6..75c10332 100644 --- a/lib/Db/PollMapper.php +++ b/lib/Db/PollMapper.php @@ -89,4 +89,17 @@ class PollMapper extends QBMapper { return $this->findEntities($qb); } + + /** + * @return void + */ + public function deleteFromUser(string $userId): void { + \OC::$server->getLogger()->alert('pollMapper->deleteFromUser(' . $userId . ')'); + $query = $this->db->getQueryBuilder(); + $query->delete($this->getTableName()) + ->where('owner = :userId') + ->setParameter('userId', $userId); + $query->execute(); + } + } |