Jackalope\Transport\Jackrabbit\Client::restoreItem PHP Method

restoreItem() public method

{@inheritDoc}
public restoreItem ( $removeExisting, $versionPath, $path )
    public function restoreItem($removeExisting, $versionPath, $path)
    {
        $path = $this->encodeAndValidatePathForDavex($path);
        $body = '<D:update xmlns:D="DAV:">
    <D:version>
        <D:href>' . $this->addWorkspacePathToUri($versionPath) . '</D:href>
    </D:version>
';
        if ($removeExisting) {
            $body .= '<dcr:removeexisting xmlns:dcr="http://www.day.com/jcr/webdav/1.0" />';
        }
        $body .= '</D:update>';
        $request = $this->getRequest(Request::UPDATE, $path);
        $request->setBody($body);
        $request->execute();
        // errors are checked in request
    }

Usage Example

 /**
  * {@inheritDoc}
  */
 public function restoreItem($removeExisting, $versionPath, $path)
 {
     $this->transport->restoreItem($removeExisting, $versionPath, $path);
 }