diff options
author | Richard Steinmetz <richard@steinmetz.cloud> | 2023-11-13 17:36:24 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-11-23 17:54:10 +0100 |
commit | d593206a30310de781dc456f965c8111900b01a9 (patch) | |
tree | 7200f338b7c2a97966cb210d32bea3909d9d44ee /apps/dav/lib/Db/AbsenceMapper.php | |
parent | 9f9abd1a57ae58289c82f0f4417507c61f9b8ab6 (diff) | |
download | nextcloud-server-d593206a30310de781dc456f965c8111900b01a9.tar.gz nextcloud-server-d593206a30310de781dc456f965c8111900b01a9.zip |
feat(dav): dispatch out-of-office started and ended events
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'apps/dav/lib/Db/AbsenceMapper.php')
-rw-r--r-- | apps/dav/lib/Db/AbsenceMapper.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/dav/lib/Db/AbsenceMapper.php b/apps/dav/lib/Db/AbsenceMapper.php index 6e1133f779c..7529d04cf10 100644 --- a/apps/dav/lib/Db/AbsenceMapper.php +++ b/apps/dav/lib/Db/AbsenceMapper.php @@ -44,6 +44,31 @@ class AbsenceMapper extends QBMapper { * @throws DoesNotExistException * @throws \OCP\DB\Exception */ + public function findById(int $id): Absence { + $qb = $this->db->getQueryBuilder(); + $qb->select('*') + ->from($this->getTableName()) + ->where($qb->expr()->eq( + 'id', + $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT), + IQueryBuilder::PARAM_INT), + ); + try { + return $this->findEntity($qb); + } catch (MultipleObjectsReturnedException $e) { + // Won't happen as id is the primary key + throw new \RuntimeException( + 'The impossible has happened! The query returned multiple absence settings for one user.', + 0, + $e, + ); + } + } + + /** + * @throws DoesNotExistException + * @throws \OCP\DB\Exception + */ public function findByUserId(string $userId): Absence { $qb = $this->db->getQueryBuilder(); $qb->select('*') |