Skip to content

Commit

Permalink
Swap isNestedTransaction() for getSavepointIdentifier()
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Dec 5, 2023
1 parent 9f57ee2 commit 0689e04
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/ConnectionTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public function getLastUsedAt(): int
return $this->executor->getLastUsedAt();
}

public function isNestedTransaction(): bool
public function getSavepointIdentifier(): ?string
{
return false;
return null;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/NestedTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ public function onRollback(\Closure $onRollback): void
$this->onRollback->getFuture()->finally($onRollback);
}

public function isNestedTransaction(): bool
public function getSavepointIdentifier(): string
{
return true;
return $this->identifier;
}

public function getIsolationLevel(): TransactionIsolation
Expand Down
6 changes: 3 additions & 3 deletions src/PooledTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ abstract protected function createTransaction(Transaction $transaction, \Closure
public function __construct(private readonly Transaction $transaction, \Closure $release)
{
$refCount = &$this->refCount;
$this->release = static function () use (&$busy, &$refCount, $release): void {
$this->release = static function () use (&$refCount, $release): void {
if (--$refCount === 0) {
$release();
}
Expand Down Expand Up @@ -167,9 +167,9 @@ public function onRollback(\Closure $onRollback): void
$this->transaction->onRollback($onRollback);
}

public function isNestedTransaction(): bool
public function getSavepointIdentifier(): ?string
{
return $this->transaction->isNestedTransaction();
return $this->transaction->getSavepointIdentifier();
}

public function getIsolationLevel(): TransactionIsolation
Expand Down

0 comments on commit 0689e04

Please sign in to comment.