unload() public method

This method reverses the effects of {@link load()}. Additionally, all associated conflicts are dereferenced.
public unload ( )
Ejemplo n.º 1
0
 /**
  * {@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();
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     if (!$this->mapping->isLoaded()) {
         return;
     }
     $this->containingModule = $this->mapping->getContainingModule();
     // Remember the conflicts that will be adjusted during unload()
     foreach ($this->mapping->getConflicts() as $conflict) {
         $this->conflicts[$conflict->getRepositoryPath()] = $conflict;
         $this->conflictingMappings[$conflict->getRepositoryPath()] = $conflict->getMappings();
     }
     $moduleName = $this->containingModule->getName();
     $this->mappings->remove($this->mapping->getRepositoryPath(), $moduleName);
     foreach ($this->mapping->listRepositoryPaths() as $repositoryPath) {
         $this->mappingsByResource->remove($repositoryPath, $moduleName);
         $this->conflictDetector->release($repositoryPath, $moduleName);
     }
     // Unload after iterating, otherwise the paths are gone
     $this->mapping->unload();
 }
Ejemplo n.º 3
0
 /**
  * @expectedException \Puli\Manager\Api\NotLoadedException
  */
 public function testUnloadFailsIfNotLoaded()
 {
     $mapping = new PathMapping('/path', 'resources');
     $mapping->unload();
 }