本文整理汇总了PHP中RedBeanPHP\R::commit方法的典型用法代码示例。如果您正苦于以下问题:PHP R::commit方法的具体用法?PHP R::commit怎么用?PHP R::commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanPHP\R
的用法示例。
在下文中一共展示了R::commit方法的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: foreach
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();
// If an item changed lanes, log the action.
if (null != $movedItem) {
logAction($user->username . ' moved item ' . $movedItem->title . ' to lane ' . $movedItem->lane->name, $beforeItem, $afterItem, $movedItem->id);
}
$jsonResponse->addBeans(getBoards());
}
$app->response->setBody($jsonResponse->asJson());
});
// Add a comment to an item.
$app->post('/items/:itemId/comment', function ($itemId) use($app, $jsonResponse) {
$data = json_decode($app->environment['slim.input']);
if (validateToken()) {
$user = getUser();
$item = R::load('item', $itemId);
if ($item->id) {
示例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;
}