diff options
author | Joas Schilling <coding@schilljs.com> | 2020-10-19 16:39:50 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-10-30 12:38:09 +0300 |
commit | 1912c91bc41d4739596d9c2c0843d45913638581 (patch) | |
tree | 2b72173e830daa049b94a4faf15d6486ee5ad4d3 /lib/Model | |
parent | 311aa4bc5ac8effc29dce331ea989bb8cf9fb341 (diff) |
Fix joining a room for users
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Model')
-rw-r--r-- | lib/Model/SessionMapper.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Model/SessionMapper.php b/lib/Model/SessionMapper.php index c45cafd90..4626ed921 100644 --- a/lib/Model/SessionMapper.php +++ b/lib/Model/SessionMapper.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace OCA\Talk\Model; use OCP\AppFramework\Db\QBMapper; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; /** @@ -52,6 +53,18 @@ class SessionMapper extends QBMapper { return $this->findEntity($query); } + /** + * @param int $attendeeId + * @return int Number of deleted entities + */ + public function deleteByAttendeeId(int $attendeeId): int { + $query = $this->db->getQueryBuilder(); + $query->delete($this->getTableName()) + ->where($query->expr()->eq('attendee_id', $query->createNamedParameter($attendeeId, IQueryBuilder::PARAM_INT))); + + return (int) $query->execute(); + } + public function createSessionFromRow(array $row): Session { return $this->mapRowToEntity([ 'id' => $row['s_id'], |