asprin
Active member
I've the following code in my addon's controller
Though the chances of this happening is almost nil, still how do I ensure that in the event any one of the
PHP:
$finder = \XF::finder('Asprin\FB:Foo')->where('sys_id', 123); // can return multiple rows
$foos = $finder->fetch();
if($finder->total() > 0)
{
foreach($foos as $foo)
{
$foo->delete();
}
}
$finder2 = \XF::finder('Asprin\FB:Bar')->where('sys_id', 456); // can return multiple rows
$bars = $finder2->fetch();
if($finder2->total() > 0)
{
foreach($bars as $bar)
{
$bar->delete();
}
}
Though the chances of this happening is almost nil, still how do I ensure that in the event any one of the
$foo
or $bar
does not delete, a rollback should kick in? Can the transaction begin/commit be applied here?