Skip to content

Commit

Permalink
Add fluid transaction check. Closes #922.
Browse files Browse the repository at this point in the history
  • Loading branch information
gabordemooij committed Mar 17, 2023
1 parent 184954f commit 274c426
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions RedBeanPHP/Facade.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ public static function useISNULLConditions( $mode )
*/
public static function transaction( $callback )
{
if ( !self::$allowFluidTransactions && !self::$redbean->isFrozen() ) return FALSE;
return Transaction::transaction( self::$adapter, $callback );
}

Expand Down
3 changes: 2 additions & 1 deletion testing/RedUNIT/Blackhole/Misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,14 @@ public function testTransactionInFacade()
pass();
}
asrt( R::count( 'bean' ), 1 );
R::freeze( FALSE );
try {
R::transaction( 'nope' );
fail();
} catch (\Exception $e ) {
pass();
}
R::freeze( FALSE );
asrt(R::transaction( 'nope' ), FALSE);
testpack( 'Test Camelcase 2 underscore' );
$names = array(
'oneACLRoute' => 'one_acl_route',
Expand Down

0 comments on commit 274c426

Please sign in to comment.