本文整理匯總了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;
}