Doctrine\ODM\PHPCR\UnitOfWork::removeVersion PHP Метод

removeVersion() публичный Метод

Delete an old version of a document
public removeVersion ( string $documentVersion )
$documentVersion string the version name
    public function removeVersion($documentVersion)
    {
        $oid = spl_object_hash($documentVersion);
        $history = $this->documentHistory[$oid];
        $version = $this->documentVersion[$oid];
        $history->removeVersion($version->getName());
        unset($this->documentVersion[$oid]);
        unset($this->documentHistory[$oid]);
    }

Usage Example

Пример #1
0
 /**
  * Delete the specified version to clean up the history.
  *
  * Note that you can not remove the currently active version, only old
  * versions.
  *
  * @param $documentVersion The version document as returned by findVersionByName
  *
  * @return void
  *
  * @throws \PHPCR\RepositoryException when trying to remove the root version or the last version
  */
 public function removeVersion($documentVersion)
 {
     $this->errorIfClosed();
     $this->unitOfWork->removeVersion($documentVersion);
 }
UnitOfWork