class TransactionSubscriber implements EventSubscriberInterface

Class TransactionSubscriber

Implement transaction management for API calls. Two API options are accepted: - is_transactional: bool|'nest' - if true, then all work is done inside a transaction. By default, true for mutator actions (C-UD). 'nest' will force creation of a nested transaction; otherwise, the default is to re-use any existing transactions. - options.force_rollback: bool - if true, all work is done in a nested transaction which will be rolled back.

Methods

static array
getSubscribedEvents()

No description

bool
isTransactional(ProviderInterface $apiProvider, array $apiRequest)

Determine if an API request should be treated as transactional.

bool
isForceRollback(ProviderInterface $apiProvider, array $apiRequest)

Determine if caller wants us to always rollback.

bool
isNested(ProviderInterface $apiProvider, array $apiRequest)

Determine if caller wants a nested transaction or a re-used transaction.

onApiPrepare( $event)

Open a new transaction instance (if appropriate in the current policy)

onApiRespond( $event)

Close any pending transactions.

onApiException( $event)

Rollback the pending transaction.

Details

at line 50
static array getSubscribedEvents()

Return Value

array

at line 80
bool isTransactional(ProviderInterface $apiProvider, array $apiRequest)

Determine if an API request should be treated as transactional.

Parameters

ProviderInterface $apiProvider The API provider responsible for this request.
array $apiRequest The full API request.

Return Value

bool

at line 99
bool isForceRollback(ProviderInterface $apiProvider, array $apiRequest)

Determine if caller wants us to always rollback.

Parameters

ProviderInterface $apiProvider The API provider responsible for this request.
array $apiRequest The full API request.

Return Value

bool

at line 120
bool isNested(ProviderInterface $apiProvider, array $apiRequest)

Determine if caller wants a nested transaction or a re-used transaction.

Parameters

ProviderInterface $apiProvider The API provider responsible for this request.
array $apiRequest The full API request.

Return Value

bool True if a new nested transaction is required; false if active tx may be used

at line 136
onApiPrepare( $event)

Open a new transaction instance (if appropriate in the current policy)

Parameters

$event API preparation event.

at line 152
onApiRespond( $event)

Close any pending transactions.

Parameters

$event API response event.

at line 168
onApiException( $event)

Rollback the pending transaction.

Parameters

$event API exception event.