本文整理汇总了PHP中RedBeanPHP\R::begin方法的典型用法代码示例。如果您正苦于以下问题:PHP R::begin方法的具体用法?PHP R::begin怎么用?PHP R::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanPHP\R
的用法示例。
在下文中一共展示了R::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setQueueRowsDone
/**
* Sets multiple queue rows as done
* @param type $rows
*/
public function setQueueRowsDone($rows)
{
R::begin();
foreach ($rows as $row) {
$res = $this->setQueueRowDone($row);
if (!$res) {
return R::rollback();
}
}
return R::commit();
}
示例2: sendEmail
$email = $user->email;
sendEmail($email, $recipient, $subject, $body);
}
}
}
$app->response->setBody($jsonResponse->asJson());
})->conditions(['itemId' => '\\d+']);
// Update item positions
$app->post('/items/positions', function () use($app, $jsonResponse) {
$data = json_decode($app->environment['slim.input']);
if (validateToken()) {
$user = getUser();
$movedItem = null;
$beforeItem = null;
$afterItem = null;
R::begin();
foreach ($data->positions as $posItem) {
$item = R::load('item', $posItem->item);
$before = $item->export();
$oldLane = $item->lane->id;
$item->lane = R::load('lane', $posItem->lane);
if ($oldLane != $item->lane->id) {
$movedItem = $item;
$beforeItem = $before;
$afterItem = $item->export();
}
$item->position = $posItem->position;
runAutoActions($item);
R::store($item);
}
R::commit();
示例3: commitBean
/**
* commit a bean with transactions
* @param object $bean
* @return $res false or last insert id
*/
public static function commitBean($bean)
{
R::begin();
try {
$res = R::store($bean);
R::commit();
} catch (Exception $e) {
R::rollback();
$res = false;
}
return $res;
}