diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 49472635e..583d27498 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -186,6 +186,11 @@ class Installer protected function doInstall($localRepo, $installedRepo, $aliases, $devMode = false) { + // initialize locker to create aliased packages + if (!$this->update && $this->locker->isLocked($devMode)) { + $lockedPackages = $this->locker->getLockedPackages($devMode); + } + // creating repository pool $pool = new Pool; $pool->addRepository($installedRepo); @@ -214,7 +219,7 @@ class Installer $this->io->write('Your lock file is out of sync with your composer.json, run "composer.phar update" to update dependencies'); } - foreach ($this->locker->getLockedPackages($devMode) as $package) { + foreach ($lockedPackages as $package) { $version = $package->getVersion(); foreach ($aliases as $alias) { if ($alias['package'] === $package->getName() && $alias['version'] === $package->getVersion()) { diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index fc448c360..e8037b464 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -95,7 +95,9 @@ class Locker if (!$package) { $package = $this->repositoryManager->findPackage($info['package'], $info['version']); if ($package && !empty($info['alias'])) { - $package = new AliasPackage($package, $info['alias'], $info['alias']); + $alias = new AliasPackage($package, $info['alias'], $info['alias']); + $package->getRepository()->addPackage($alias); + $package = $alias; } }