Skip to content
Snippets Groups Projects
Commit 3635b823 authored by colemanw's avatar colemanw
Browse files

Skip wrapping v4 api requests in a transaction

Transactions aren't a bad thing and we probably want to revisit this but
for now I'm disabling it becuase it's broken, as seen in api_v3_ActivityTest.
I think the problem is with the onApiException event not being dispatched
because api4 doesn't go through Kernel->runSafe, so transactions aren't
being rolled back when they should.
parent 6233ba43
Branches
Tags
No related merge requests found
......@@ -79,6 +79,9 @@ class TransactionSubscriber implements EventSubscriberInterface {
* @return bool
*/
public function isTransactional($apiProvider, $apiRequest) {
if ($apiRequest['version'] == 4) {
return FALSE;
}
if ($this->isForceRollback($apiProvider, $apiRequest)) {
return TRUE;
}
......@@ -98,6 +101,9 @@ class TransactionSubscriber implements EventSubscriberInterface {
* @return bool
*/
public function isForceRollback($apiProvider, $apiRequest) {
if ($apiRequest['version'] == 4) {
return FALSE;
}
// FIXME: When APIv3 uses better parsing, only one check will be needed.
if (isset($apiRequest['params']['options']['force_rollback'])) {
return \CRM_Utils_String::strtobool($apiRequest['params']['options']['force_rollback']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment