trait OptimisticLockingTrait

Optimistic locking trait.

Methods

array
getOptimisticLockingTraitHooks()

Returns trait hooks.

__clone()

Making sure that cloning returns a "fresh copy" of the record.

string
getLockingColumn()

Returns the optimistic locking column.

bool
reload()

Reloads the record from the database.

setLockVersion(int $version)

Sets the optimistic locking version.

int
getLockVersion()

Returns the optimistic locking version.

bool
updateRecord(Query $query)

Updates an existing record.

bool
deleteRecord(Query $query)

Deletes a record from the database.

Details

at line 28
protected array getOptimisticLockingTraitHooks()

Returns trait hooks.

Return Value

array

at line 58
__clone()

Making sure that cloning returns a "fresh copy" of the record.

at line 73
protected string getLockingColumn()

Returns the optimistic locking column.

Return Value

string

at line 83
bool reload()

Reloads the record from the database.

Return Value

bool

at line 107
setLockVersion(int $version)

Sets the optimistic locking version.

Parameters

int $version Locking version

at line 117
int getLockVersion()

Returns the optimistic locking version.

Return Value

int

at line 129
protected bool updateRecord(Query $query)

Updates an existing record.

Parameters

Query $query Query builder

Return Value

bool

Exceptions

StaleRecordException

at line 156
protected bool deleteRecord(Query $query)

Deletes a record from the database.

Parameters

Query $query Query builder

Return Value

bool

Exceptions

StaleRecordException