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(PrepareEvent $event)

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

onApiRespond(RespondEvent $event)

Close any pending transactions.

onApiException(ExceptionEvent $event)

Rollback the pending transaction.

Details

at line 51
static array getSubscribedEvents()

Return Value

array

at line 81
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 103
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 127
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 143
onApiPrepare(PrepareEvent $event)

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

Parameters

PrepareEvent $event API preparation event.

at line 159
onApiRespond(RespondEvent $event)

Close any pending transactions.

Parameters

RespondEvent $event API response event.

at line 175
onApiException(ExceptionEvent $event)

Rollback the pending transaction.

Parameters

ExceptionEvent $event API exception event.