public function updatePrincipal($path, DAV\PropPatch $propPatch)
    {
        $propPatch->handle(array_keys($this->fieldMap), function ($properties) use ($path) {
            $query = 'UPDATE '.$this->tableName.' SET ';
            $first = true;

            $values = [];

            foreach ($properties as $key => $value) {
                $dbField = $this->fieldMap[$key]['dbField'];

                if (!$first) {
                    $query .= ', ';
                }
                $first = false;
                $query .= $dbField.' = :'.$dbField;
                $values[$dbField] = $value;
            }

            $query .= ' WHERE uri = :uri';
            $values['uri'] = $path;

            $stmt = $this->pdo->prepare($query);
            $stmt->execute($values);

            return true;
        });
    }
public function updatePrincipal($path, DAV\PropPatch $propPatch)
    {
        $propPatch->handle(array_keys($this->fieldMap), function ($properties) use ($path) {
            $query = 'UPDATE '.$this->tableName.' SET ';
            $first = true;

            $values = [];

            foreach ($properties as $key => $value) {
                $dbField = $this->fieldMap[$key]['dbField'];

                if (!$first) {
                    $query .= ', ';
                }
                $first = false;
                $query .= $dbField.' = :'.$dbField;
                $values[$dbField] = $value;
            }

            $query .= ' WHERE uri = :uri';
            $values['uri'] = $path;

            $stmt = $this->pdo->prepare($query);
            $stmt->execute($values);

            return true;
        });
    }
public function updatePrincipal ( $ path , DAV \ PropPatch $ propPatch ) { $ propPatch -> handle ( array_keys ( $ this -> fieldMap ) , function ( $ properties ) use ( $ path ) { $ query = 'UPDATE ' . $ this -> tableName . ' SET ' ; $ first = true ; $ values = [ ] ; foreach ( $ properties as $ key => $ value ) { $ dbField = $ this -> fieldMap [ $ key ] [ 'dbField' ] ; if ( ! $ first ) { $ query .= ', ' ; } $ first = false ; $ query .= $ dbField . ' = :' . $ dbField ; $ values [ $ dbField ] = $ value ; } $ query .= ' WHERE uri = :uri' ; $ values [ 'uri' ] = $ path ; $ stmt = $ this -> pdo -> prepare ( $ query ) ; $ stmt -> execute ( $ values ) ; return true ; } ) ; }
Updates one ore more webdav properties on a principal.

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        $path
@param DAV\PropPatch $propPatch
Updates one ore more webdav properties on a principal .