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.

bool
hasApplicableTransaction()

Determine whether this connection has a transaction that delays after-commit callbacks.

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 129
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 177
void beginTransaction()

Start a new database transaction.

Return Value

void

Exceptions

Throwable

at line 215
protected void createTransaction()

Create a transaction within the database.

Return Value

void

Exceptions

Throwable

at line 235
protected void handleBeginTransactionException(Throwable $e)

Handle an exception from a transaction beginning.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

at line 251
void commit()

Commit the active database transaction.

Return Value

void

Exceptions

Throwable

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

Rollback the active database transaction.

Parameters

int|null $toLevel

Return Value

void

Exceptions

Throwable

at line 413
protected void handleRollBackException(Throwable $e)

Handle an exception from a rollback.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

at line 433
protected void forgetLostConnection()

Forget a connection after a lost transaction operation.

Return Value

void

at line 450
int transactionLevel()

Get the number of active transactions.

Return Value

int

at line 460
bool hasApplicableTransaction()

Determine whether this connection has a transaction that delays after-commit callbacks.

Without a transaction manager, any open transaction counts.

Return Value

bool

at line 476
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 490
void afterCommitOrNow(callable $callback)

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

Parameters

callable $callback

Return Value

void

at line 508
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