Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
bohanyang committed Sep 9, 2023
1 parent aee10ed commit 0f20ad2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/mango/Doctrine/Exception/UnexpectedRowsAffected.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#[WithHttpStatus(409)]
class UnexpectedRowsAffected extends RuntimeException implements ExceptionInterface
{
public static function create(int $expectedRowNum, int $rowNum)
public static function create(int $expected, int $actual)
{
return new self(sprintf('Unexpected number of rows affected: actual %d; expected %d.', $rowNum, $expectedRowNum));
return new self(sprintf('Unexpected number of rows affected: actual %d; expected %d.', $actual, $expected));
}
}
10 changes: 5 additions & 5 deletions packages/mango/Doctrine/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -878,15 +878,15 @@ public function gte(string|array $x, $y): string
return $this->comparison($x, '>=', $y);
}

public function executeStatement(?int $expectedRowNum = null): int
public function executeStatement(?int $rowsAffected = null): int
{
$rowNum = $this->builder->executeStatement();
$actual = $this->builder->executeStatement();

if ($rowNum !== ($expectedRowNum ?? $rowNum)) {
throw UnexpectedRowsAffected::create($expectedRowNum, $rowNum);
if ($actual !== ($rowsAffected ?? $actual)) {
throw UnexpectedRowsAffected::create($rowsAffected, $actual);
}

return $rowNum;
return $actual;
}

public function __call($name, $arguments)
Expand Down

0 comments on commit 0f20ad2

Please sign in to comment.