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
handleBeginTransactionException(Throwable $e)

Handle an exception from a transaction beginning.

void
commit()

Commit the active database 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
handleRollBackException(Throwable $e)

Handle an exception from a rollback.

void
forgetLostConnection()

Forget a connection after a lost transaction operation.

int
transactionLevel()

Get the number of active transactions.

void
afterCommit(callable $callback)

Execute the callback after a transaction commits.

void
afterCommitOrNow(callable $callback)

Execute the callback after commit, or immediately when no transaction exists.

void
afterRollBack(callable $callback)

Execute the callback after a transaction rolls back.

Details

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

No description

Parameters

Closure $callback
int $attempts

Return Value

mixed

Exceptions

Throwable

at line 114
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 176
void beginTransaction()

Start a new database transaction.

Return Value

void

Exceptions

Throwable

at line 214
protected void createTransaction()

Create a transaction within the database.

Return Value

void

Exceptions

Throwable

at line 234
protected void handleBeginTransactionException(Throwable $e)

Handle an exception from a transaction beginning.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

at line 250
void commit()

Commit the active database transaction.

Return Value

void

Exceptions

Throwable

at line 294
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 336
void rollBack(int|null $toLevel = null)

Rollback the active database transaction.

Parameters

int|null $toLevel

Return Value

void

Exceptions

Throwable

at line 390
protected void handleRollBackException(Throwable $e)

Handle an exception from a rollback.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

at line 408
protected void forgetLostConnection()

Forget a connection after a lost transaction operation.

Return Value

void

at line 420
int transactionLevel()

Get the number of active transactions.

Return Value

int

at line 432
void afterCommit(callable $callback)

Execute the callback after a transaction commits.

The callback belongs to this connection's open transaction stack.

Parameters

callable $callback

Return Value

void

Exceptions

RuntimeException

at line 446
void afterCommitOrNow(callable $callback)

Execute the callback after commit, or immediately when no transaction exists.

Parameters

callable $callback

Return Value

void

at line 464
void afterRollBack(callable $callback)

Execute the callback after a transaction rolls back.

The callback belongs to this connection's open transaction stack.

Parameters

callable $callback

Return Value

void

Exceptions

RuntimeException