Skip to content

Commit

Permalink
Ensure unique constraint usage in find
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Mar 15, 2022
1 parent 3271833 commit f6edbd1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Application/Processor/Handler/PackageDiscoveryHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
]
);

Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit f6edbd1

Please sign in to comment.