aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Db
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2023-11-08 13:26:56 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2023-11-14 13:57:12 +0100
commit5b7a5474b9fe9bc08f65f48c115ea08ecac5a73c (patch)
treed64f891e09893d2b6ce19e60530206736c451c32 /apps/dav/lib/Db
parentf313b12d54a831f3788bb44d7f51bb8f1ac54583 (diff)
downloadnextcloud-server-5b7a5474b9fe9bc08f65f48c115ea08ecac5a73c.tar.gz
nextcloud-server-5b7a5474b9fe9bc08f65f48c115ea08ecac5a73c.zip
feat(caldav): Create personal event for out-of-office messages
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/lib/Db')
-rw-r--r--apps/dav/lib/Db/Absence.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/dav/lib/Db/Absence.php b/apps/dav/lib/Db/Absence.php
index e9ce1d2ea64..8de8ecc9aa0 100644
--- a/apps/dav/lib/Db/Absence.php
+++ b/apps/dav/lib/Db/Absence.php
@@ -27,6 +27,7 @@ declare(strict_types=1);
namespace OCA\DAV\Db;
use DateTimeImmutable;
+use Exception;
use InvalidArgumentException;
use JsonSerializable;
use OC\User\OutOfOfficeData;
@@ -70,8 +71,10 @@ class Absence extends Entity implements JsonSerializable {
if ($user->getUID() !== $this->getUserId()) {
throw new InvalidArgumentException("The user doesn't match the user id of this absence! Expected " . $this->getUserId() . ", got " . $user->getUID());
}
+ if ($this->getId() === null) {
+ throw new Exception('Creating out-of-office data without ID');
+ }
- //$user = $userManager->get($this->getUserId());
$startDate = new DateTimeImmutable($this->getFirstDay());
$endDate = new DateTimeImmutable($this->getLastDay());
return new OutOfOfficeData(