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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getContainingModule ( ) : Puli\Manager\Api\Module\Module
Результат Puli\Manager\Api\Module\Module The containing module or `null` if the mapping has not been loaded.
Пример #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();
 }
Пример #2
0
 /**
  * Removes a path mapping from the conflict.
  *
  * If only one path mapping is left after removing this mapping, that
  * mapping is removed as well. The conflict is then resolved.
  *
  * @param PathMapping $mapping The path mapping to remove.
  *
  * @throws NotLoadedException If the passed mapping is not loaded.
  */
 public function removeMapping(PathMapping $mapping)
 {
     if (!$mapping->isLoaded()) {
         throw new NotLoadedException('The passed mapping must be loaded.');
     }
     $moduleName = $mapping->getContainingModule()->getName();
     if (!isset($this->mappings[$moduleName]) || $mapping !== $this->mappings[$moduleName]) {
         return;
     }
     unset($this->mappings[$moduleName]);
     $mapping->removeConflict($this);
     // Conflict was resolved
     if (count($this->mappings) < 2) {
         $resolvedMappings = $this->mappings;
         $this->mappings = array();
         foreach ($resolvedMappings as $resolvedMapping) {
             $resolvedMapping->removeConflict($this);
         }
     }
 }