Transaction
+ Inheritance diagram for Transaction:

Description

Scoped transaction/savepoint.

If the instance isn't committed before it loses scope, it's rolled back. There is no rollback() method.

In order to ensure proper destruction, the instance MUST NOT leave the scope it's created in.

Protected Properties

bool $committed = false
 
DB $db
 

Public Static Methods

magic static self factory (DB $db)
 

Public Methods

 __construct (DB $db)
 Begins the transaction/savepoint. More...
 
 __destruct ()
 Rolls back if the instance wasn't committed. More...
 
true commit ()
 Commits the transaction/savepoint. More...
 
bool wasCommitted ()
 

Constructor

◆ __construct()

__construct ( DB  $db)

Begins the transaction/savepoint.

Parameters
DB$db

◆ __destruct()

__destruct ( )

Rolls back if the instance wasn't committed.

Methods

◆ commit()

true commit ( )

Commits the transaction/savepoint.

This is safe to call multiple times, it won't have any effect after the first time.

Returns
true

◆ factory()

magic static self factory ( DB  $db)
static
Returns
self

◆ wasCommitted()

bool wasCommitted ( )
final
Returns
bool