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

getContainingModule() public method

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getContainingModule ( ) : Puli\Manager\Api\Module\Module
return Puli\Manager\Api\Module\Module The containing module or `null` if the mapping has not been loaded.
    public function getContainingModule()
    {
        if (null === $this->state) {
            throw new NotLoadedException('The mapping is not loaded.');
        }
        return $this->containingModule;
    }

Usage Example

Ejemplo n.º 1
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();
 }
All Usage Examples Of Puli\Manager\Api\Repository\PathMapping::getContainingModule