Puli\Manager\Api\Repository\PathMapping::unload PHP Method

unload() public method

This method reverses the effects of {@link load()}. Additionally, all associated conflicts are dereferenced.
public unload ( )
    public function unload()
    {
        if (null === $this->state) {
            throw new NotLoadedException('The mapping is not loaded.');
        }
        $conflictsToRelease = $this->conflicts;
        $this->conflicts = array();
        foreach ($conflictsToRelease as $conflict) {
            $conflict->removeMapping($this);
        }
        $this->filesystemPaths = array();
        $this->pathMappings = array();
        $this->repositoryPaths = array();
        $this->loadErrors = array();
        $this->containingModule = null;
        $this->state = null;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function rollback()
 {
     if (!$this->mapping->isLoaded()) {
         return;
     }
     $packageName = $this->containingPackage->getName();
     $this->mappings->remove($this->mapping->getRepositoryPath(), $packageName);
     foreach ($this->mapping->listRepositoryPaths() as $repositoryPath) {
         $this->mappingsByResource->remove($repositoryPath, $packageName);
         $this->conflictDetector->release($repositoryPath, $packageName);
     }
     // Unload after iterating, otherwise the paths are gone
     $this->mapping->unload();
 }
All Usage Examples Of Puli\Manager\Api\Repository\PathMapping::unload