public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
    {
        $supportedProperties = [
            '{DAV:}displayname',
            '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description',
        ];

        $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
            $updates = [];
            foreach ($mutations as $property => $newValue) {
                switch ($property) {
                    case '{DAV:}displayname':
                        $updates['displayname'] = $newValue;
                        break;
                    case '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description':
                        $updates['description'] = $newValue;
                        break;
                }
            }
            $query = 'UPDATE '.$this->addressBooksTableName.' SET ';
            $first = true;
            foreach ($updates as $key => $value) {
                if ($first) {
                    $first = false;
                } else {
                    $query .= ', ';
                }
                $query .= ' '.$key.' = :'.$key.' ';
            }
            $query .= ' WHERE id = :addressbookid';

            $stmt = $this->pdo->prepare($query);
            $updates['addressbookid'] = $addressBookId;

            $stmt->execute($updates);

            $this->addChange($addressBookId, '', 2);

            return true;
        });
    }
public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
    {
        $supportedProperties = [
            '{DAV:}displayname',
            '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description',
        ];

        $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
            $updates = [];
            foreach ($mutations as $property => $newValue) {
                switch ($property) {
                    case '{DAV:}displayname':
                        $updates['displayname'] = $newValue;
                        break;
                    case '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description':
                        $updates['description'] = $newValue;
                        break;
                }
            }
            $query = 'UPDATE '.$this->addressBooksTableName.' SET ';
            $first = true;
            foreach ($updates as $key => $value) {
                if ($first) {
                    $first = false;
                } else {
                    $query .= ', ';
                }
                $query .= ' '.$key.' = :'.$key.' ';
            }
            $query .= ' WHERE id = :addressbookid';

            $stmt = $this->pdo->prepare($query);
            $updates['addressbookid'] = $addressBookId;

            $stmt->execute($updates);

            $this->addChange($addressBookId, '', 2);

            return true;
        });
    }
public function updateAddressBook ( $ addressBookId , \ Sabre \ DAV \ PropPatch $ propPatch ) { $ supportedProperties = [ '{DAV:}displayname' , '{' . CardDAV \ Plugin :: NS_CARDDAV . '}addressbook-description' , ] ; $ propPatch -> handle ( $ supportedProperties , function ( $ mutations ) use ( $ addressBookId ) { $ updates = [ ] ; foreach ( $ mutations as $ property => $ newValue ) { switch ( $ property ) { case '{DAV:}displayname' : $ updates [ 'displayname' ] = $ newValue ; break ; case '{' . CardDAV \ Plugin :: NS_CARDDAV . '}addressbook-description' : $ updates [ 'description' ] = $ newValue ; break ; } } $ query = 'UPDATE ' . $ this -> addressBooksTableName . ' SET ' ; $ first = true ; foreach ( $ updates as $ key => $ value ) { if ( $ first ) { $ first = false ; } else { $ query .= ', ' ; } $ query .= ' ' . $ key . ' = :' . $ key . ' ' ; } $ query .= ' WHERE id = :addressbookid' ; $ stmt = $ this -> pdo -> prepare ( $ query ) ; $ updates [ 'addressbookid' ] = $ addressBookId ; $ stmt -> execute ( $ updates ) ; $ this -> addChange ( $ addressBookId , '' , 2 ) ; return true ; } ) ; }
Updates properties for an address book.

The list of mutations is stored in a Sabre\DAV\PropPatch object.
To do the actual updates, you must tell this object which properties
you're going to process with the handle() method.

Calling the handle method is like telling the PropPatch object "I
promise I can handle updating this property".

Read the PropPatch documentation for more info and examples.

@param string               $addressBookId
@param \Sabre\DAV\PropPatch $propPatch
Updates properties for an address book .