trait ManagesTransactions mixin Connection

Methods

mixed
transaction(Closure $callback, int $attempts = 1)

No description

void
handleTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)

Handle an exception encountered when running a transacted statement.

void
beginTransaction()

Start a new database transaction.

void
createTransaction()

Create a transaction within the database.

void
createSavepoint()

Create a save point within the database.

void
handleBeginTransactionException(Throwable $e)

Handle an exception from a transaction beginning.

void
commit()

Commit the active database transaction.

void
performCommit()

Commit the active physical transaction.

void
handleCommitTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)

Handle an exception encountered when committing a transaction.

void
rollBack(int|null $toLevel = null)

Rollback the active database transaction.

void
performRollBack(int $toLevel, PDO $pdo)

Perform a rollback within the database.

void
handleRollBackException(Throwable $e)

Handle an exception from a rollback.

void
terminateTransactionState()

Detach transaction records and physical connection references.

int
transactionLevel()

Get the number of active transactions.

void
afterCommit(callable $callback)

Execute the callback after a transaction commits.

void
afterRollBack(callable $callback)

Execute the callback after a transaction rolls back.

Details

at line 29
mixed transaction(Closure $callback, int $attempts = 1)

No description

Parameters

Closure $callback
int $attempts

Return Value

mixed

Exceptions

Throwable

at line 109
protected void handleTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)

Handle an exception encountered when running a transacted statement.

Parameters

Throwable $e
int $currentAttempt
int $maxAttempts

Return Value

void

Exceptions

Throwable

at line 163
void beginTransaction()

Start a new database transaction.

Return Value

void

Exceptions

Throwable

at line 197
protected void createTransaction()

Create a transaction within the database.

Return Value

void

Exceptions

Throwable

at line 217
protected void createSavepoint()

Create a save point within the database.

Return Value

void

Exceptions

Throwable

at line 229
protected void handleBeginTransactionException(Throwable $e)

Handle an exception from a transaction beginning.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

at line 245
void commit()

Commit the active database transaction.

Return Value

void

Exceptions

Throwable

at line 283
protected void performCommit()

Commit the active physical transaction.

Return Value

void

at line 306
protected void handleCommitTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)

Handle an exception encountered when committing a transaction.

Parameters

Throwable $e
int $currentAttempt
int $maxAttempts

Return Value

void

Exceptions

Throwable

at line 340
void rollBack(int|null $toLevel = null)

Rollback the active database transaction.

Parameters

int|null $toLevel

Return Value

void

Exceptions

Throwable

at line 398
protected void performRollBack(int $toLevel, PDO $pdo)

Perform a rollback within the database.

Parameters

int $toLevel
PDO $pdo

Return Value

void

Exceptions

Throwable

at line 416
protected void handleRollBackException(Throwable $e)

Handle an exception from a rollback.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

at line 432
protected void terminateTransactionState()

Detach transaction records and physical connection references.

Return Value

void

at line 453
int transactionLevel()

Get the number of active transactions.

Return Value

int

at line 463
void afterCommit(callable $callback)

Execute the callback after a transaction commits.

Parameters

callable $callback

Return Value

void

Exceptions

RuntimeException

at line 479
void afterRollBack(callable $callback)

Execute the callback after a transaction rolls back.

Parameters

callable $callback

Return Value

void

Exceptions

RuntimeException