Invalidate map cache when addPackage/removePackage is called
parent
96af983700
commit
44cdc37c0c
|
@ -28,6 +28,10 @@ class ArrayRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
/** @var PackageInterface[] */
|
/** @var PackageInterface[] */
|
||||||
protected $packages;
|
protected $packages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PackageInterface[] indexed by package unique name and used to cache hasPackage calls
|
||||||
|
*/
|
||||||
protected $packageMap;
|
protected $packageMap;
|
||||||
|
|
||||||
public function __construct(array $packages = array())
|
public function __construct(array $packages = array())
|
||||||
|
@ -151,6 +155,9 @@ class ArrayRepository extends BaseRepository
|
||||||
$this->addPackage($aliasedPackage);
|
$this->addPackage($aliasedPackage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// invalidate package map cache
|
||||||
|
$this->packageMap = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
|
protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
|
||||||
|
@ -171,6 +178,9 @@ class ArrayRepository extends BaseRepository
|
||||||
if ($packageId === $repoPackage->getUniqueName()) {
|
if ($packageId === $repoPackage->getUniqueName()) {
|
||||||
array_splice($this->packages, $key, 1);
|
array_splice($this->packages, $key, 1);
|
||||||
|
|
||||||
|
// invalidate package map cache
|
||||||
|
$this->packageMap = null;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue