Esempio n. 1
0
 /**
  * @param int $addressBookId
  * @param int $newAddressBookId
  */
 private function migrateShares($addressBookId, $newAddressBookId)
 {
     $shares = $this->adapter->getShares($addressBookId);
     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);
     $newAddressBook = $this->backend->getAddressBookById($newAddressBookId);
     $book = new AddressBook($this->backend, $newAddressBook);
     $this->backend->updateShares($book, $add, []);
 }