From f6edbd12d8fb2424c66a56780c8ccbea79b0139e Mon Sep 17 00:00:00 2001 From: Flavio Heleno Date: Tue, 15 Mar 2022 19:35:49 -0300 Subject: [PATCH] Ensure unique constraint usage in find --- .../Processor/Handler/PackageDiscoveryHandler.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Application/Processor/Handler/PackageDiscoveryHandler.php b/src/Application/Processor/Handler/PackageDiscoveryHandler.php index 6fe460ce..d7f43480 100644 --- a/src/Application/Processor/Handler/PackageDiscoveryHandler.php +++ b/src/Application/Processor/Handler/PackageDiscoveryHandler.php @@ -156,12 +156,11 @@ public function __invoke(CommandInterface $command): HandlerResultEnum { // exclude branches from tagged releases (https://getcomposer.org/doc/articles/versions.md#branches) $isBranch = preg_match('/^dev-|-dev$/', $release['version']) === 1; + // find by the unique constraint (number, package_name) $versionCol = $this->versionRepository->find( [ 'number' => $release['version'], - 'normalized' => $release['version_normalized'], - 'package_name' => $package->getName(), - 'release' => $isBranch === false + 'package_name' => $package->getName() ] ); @@ -205,6 +204,7 @@ static function (string $key): bool { continue; } + // find by the unique constraint (version_id, name, development) $dependencyCol = $this->dependencyRepository->find( [ 'version_id' => $version->getId(), @@ -244,6 +244,7 @@ static function (string $key): bool { continue; } + // find by the unique constraint (version_id, name, development) $dependencyCol = $this->dependencyRepository->find( [ 'version_id' => $version->getId(),