diff options
author | emkael <emkael@tlen.pl> | 2016-05-06 17:13:01 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-05-06 17:13:01 +0200 |
commit | a69844e2640d559ecd78fbe39d1bcadc1cb53d15 (patch) | |
tree | 559f3d6fb7215b291a6738b3310a3543f6c45abd /app | |
parent | cd2b68cdacf635807943eec8257103b4f4cef521 (diff) |
* mass setting of user-preferred calendars
Diffstat (limited to 'app')
-rw-r--r-- | app/php/facades/CalendarFacade.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/php/facades/CalendarFacade.php b/app/php/facades/CalendarFacade.php index 5eed764..232acf3 100644 --- a/app/php/facades/CalendarFacade.php +++ b/app/php/facades/CalendarFacade.php @@ -96,6 +96,20 @@ class CalendarFacade extends Facade { $preference->save(); } + public function setPreferredCalendars(User $user, $calendars) { + //TODO: remove old preference, optionally + $transaction = $this->beginTransaction(); + try { + foreach ($calendars as $calendar) { + $this->setPreferredCalendar($user, $calendar); + } + $transaction->commit(); + } catch (Exception $e) { + $transaction->rollback(); + throw $e; + } + } + public function getEventsForTimeframe(CalendarDTO $calendar, DateTime $dateFrom, DateTime $dateTo, |