Jackalope\ObjectManager::removeVersion PHP Method

removeVersion() public method

Remove a version given the path to the version node and the version name.
public removeVersion ( string $versionPath, string $versionName )
$versionPath string The path to the version node
$versionName string The name of the version to remove
    public function removeVersion($versionPath, $versionName)
    {
        $this->transport->removeVersion($versionPath, $versionName);
        // Adjust the in memory state
        $absPath = $versionPath . '/' . $versionName;
        if (isset($this->objectsByPath['Node'][$absPath])) {
            /** @var $node Node */
            $node = $this->objectsByPath['Node'][$absPath];
            unset($this->objectsByUuid[$node->getIdentifier()]);
            $node->setDeleted();
        }
        if (isset($this->objectsByPath['Version\\Version'][$absPath])) {
            /** @var $version \Jackalope\Version\Version */
            $version = $this->objectsByPath['Version\\Version'][$absPath];
            unset($this->objectsByUuid[$version->getIdentifier()]);
            $version->setDeleted();
        }
        unset($this->objectsByPath['Node'][$absPath], $this->objectsByPath['Version\\Version'][$absPath]);
        $this->cascadeDelete($absPath, false);
        $this->cascadeDeleteVersion($absPath);
    }