/** * {@inheritdoc} */ public function execute() { if ($this->rootPackageFile->hasPathMapping($this->repositoryPath)) { $this->previousMapping = $this->rootPackageFile->getPathMapping($this->repositoryPath); $this->rootPackageFile->removePathMapping($this->repositoryPath); } }
/** * {@inheritdoc} */ public function execute() { $repositoryPath = $this->mapping->getRepositoryPath(); if ($this->rootPackageFile->hasPathMapping($repositoryPath)) { $this->previousMapping = $this->rootPackageFile->getPathMapping($repositoryPath); } $this->rootPackageFile->addPathMapping($this->mapping); }
/** * {@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->rootPackageFile->hasPathMapping($mapping->getRepositoryPath())) { throw DuplicatePathMappingException::forRepositoryPath($mapping->getRepositoryPath(), $this->rootPackage->getName()); } $tx = new Transaction(); try { $syncOp = $this->syncRepositoryPath($mapping->getRepositoryPath()); $syncOp->takeSnapshot(); $tx->execute($this->loadPathMapping($mapping, $this->rootPackage)); if (!($flags & self::IGNORE_FILE_NOT_FOUND)) { $this->assertNoLoadErrors($mapping); } $tx->execute($this->updateConflicts($mapping->listRepositoryPaths())); $tx->execute($this->overrideConflictingPackages($mapping)); $tx->execute($this->updateConflicts()); $tx->execute($this->addPathMappingToPackageFile($mapping)); $tx->execute($syncOp); $this->saveRootPackageFile(); $tx->commit(); } catch (Exception $e) { $tx->rollback(); throw $e; } }