/**
  * {@inheritdoc}
  */
 public function execute()
 {
     if ($this->rootModuleFile->hasPathMapping($this->repositoryPath)) {
         $this->previousMapping = $this->rootModuleFile->getPathMapping($this->repositoryPath);
         $this->rootModuleFile->removePathMapping($this->repositoryPath);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $repositoryPath = $this->mapping->getRepositoryPath();
     if ($this->rootModuleFile->hasPathMapping($repositoryPath)) {
         $this->previousMapping = $this->rootModuleFile->getPathMapping($repositoryPath);
     }
     $this->rootModuleFile->addPathMapping($this->mapping);
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function addRootPathMapping(PathMapping $mapping, $flags = 0)
 {
     Assert::integer($flags, 'The argument $flags must be a boolean.');
     $this->assertMappingsLoaded();
     if (!($flags & self::OVERRIDE) && $this->rootModuleFile->hasPathMapping($mapping->getRepositoryPath())) {
         throw DuplicatePathMappingException::forRepositoryPath($mapping->getRepositoryPath(), $this->rootModule->getName());
     }
     $tx = new Transaction();
     try {
         $syncOp = $this->syncRepositoryPath($mapping->getRepositoryPath());
         $syncOp->takeSnapshot();
         $tx->execute($this->loadPathMapping($mapping, $this->rootModule));
         if (!($flags & self::IGNORE_FILE_NOT_FOUND)) {
             $this->assertNoLoadErrors($mapping);
         }
         $tx->execute($this->updateConflicts($mapping->listRepositoryPaths()));
         $tx->execute($this->overrideConflictingModules($mapping));
         $tx->execute($this->updateConflicts());
         $tx->execute($this->addPathMappingToModuleFile($mapping));
         $tx->execute($syncOp);
         $this->saveRootModuleFile();
         $tx->commit();
     } catch (Exception $e) {
         $tx->rollback();
         throw $e;
     }
 }