本文整理汇总了PHP中XDB::runTransaction方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::runTransaction方法的具体用法?PHP XDB::runTransaction怎么用?PHP XDB::runTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDB
的用法示例。
在下文中一共展示了XDB::runTransaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(&$global_success)
{
$global_success = true;
$this->fetchData();
foreach ($this->settings as $field => &$setting) {
$success = false;
if (!is_null($setting)) {
$this->values[$field] = $setting->value($this, $field, Post::v($field, ''), $success);
} else {
$success = true;
$this->values[$field] = Post::v($field, '');
}
$this->errors[$field] = !$success;
$global_success = $global_success && $success;
}
if ($global_success) {
if ($this->checkChanges()) {
/* Save changes atomically to avoid inconsistent state
* in case of error.
*/
if (!XDB::runTransaction(array($this, 'saveData'))) {
$global_success = false;
return PlWizard::CURRENT_PAGE;
}
$this->markChange();
}
// XXX: removes this code once all merge related issues have been fixed.
static $issues = array(0 => array('name', 'promo', 'phone', 'education'), 1 => array('address'), 2 => array('job'));
if (isset($issues[Post::i('valid_page')])) {
foreach ($issues[Post::i('valid_page')] as $issue) {
XDB::execute("UPDATE profile_merge_issues\n SET issues = REPLACE(issues, {?}, '')\n WHERE pid = {?}", $issue, $this->pid());
}
}
return Post::has('next_page') ? PlWizard::NEXT_PAGE : PlWizard::CURRENT_PAGE;
}
$text = "Certains champs n'ont pas pu être validés, merci de corriger les informations " . (S::user()->isMe($this->owner) ? "de ton profil et de revalider ta demande." : "du profil et de revalider ta demande.");
Platal::page()->trigError($text);
return PlWizard::CURRENT_PAGE;
}