Beispiel #1
0
 /**
  * @param int $calendarId
  * @param int $newCalendarId
  */
 private function migrateShares($calendarId, $newCalendarId)
 {
     $shares = $this->adapter->getShares($calendarId);
     if (empty($shares)) {
         return;
     }
     $add = array_map(function ($s) {
         $prefix = 'principal:principals/users/';
         if ($s['share_type'] === 1) {
             $prefix = 'principal:principals/groups/';
         }
         return ['href' => $prefix . $s['share_with']];
     }, $shares);
     $newCalendar = $this->backend->getCalendarById($newCalendarId);
     $calendar = new Calendar($this->backend, $newCalendar);
     $this->backend->updateShares($calendar, $add, []);
 }