本文整理匯總了PHP中Hooks::callHooks方法的典型用法代碼示例。如果您正苦於以下問題:PHP Hooks::callHooks方法的具體用法?PHP Hooks::callHooks怎麽用?PHP Hooks::callHooks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Hooks
的用法示例。
在下文中一共展示了Hooks::callHooks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: closeTransaction
public function closeTransaction($succesMessage = 'Updated', $checkAllConjucts = true, $databaseCommit = false, $setNewContent = true)
{
$session = Session::singleton();
Hooks::callHooks('preDatabaseCloseTransaction', get_defined_vars());
Notifications::addLog('========================= CLOSING TRANSACTION =========================', 'DATABASE');
if ($checkAllConjucts) {
Notifications::addLog("Check all conjuncts", 'DATABASE');
// Evaluate all invariant conjuncts. Conjuncts are cached.
$invariantRulesHold = RuleEngine::checkInvariantRules();
// Evaluate all signal conjuncts. Conjuncts are cached
RuleEngine::checkProcessRules();
} else {
Notifications::addLog("Check all affected conjuncts", 'DATABASE');
// Evaluate all affected invariant conjuncts. Conjuncts are cached.
$invariantRulesHold = RuleEngine::checkInvariantRules(RuleEngine::getAffectedInvConjuncts($this->affectedConcepts, $this->affectedRelations), true);
// Evaluate all affected signal conjuncts. Conjuncts are cached
RuleEngine::checkConjuncts(RuleEngine::getAffectedSigConjuncts($this->affectedConcepts, $this->affectedRelations), true);
// Check only those process rules that are relevant for the activate roles
RuleEngine::checkProcessRules($session);
}
unset($this->affectedConcepts, $this->affectedRelations);
$this->affectedConcepts = array();
$this->affectedRelations = array();
if ($setNewContent && isset($session->atom)) {
$session->atom->setNewContent($session->interface);
}
// e.g. not needed in Atom::delete() function
if ($invariantRulesHold && $databaseCommit) {
$this->commitTransaction();
// commit database transaction
Notifications::addSuccess($succesMessage);
} elseif (Config::get('ignoreInvariantViolations', 'transactions') && COMMIT_INV_VIOLATIONS) {
$this->commitTransaction();
Notifications::addError("Transaction committed with invariant violations");
} elseif ($invariantRulesHold) {
$this->rollbackTransaction();
// rollback database transaction
Notifications::addInfo($succesMessage);
} else {
$this->rollbackTransaction();
// rollback database transaction
}
Hooks::callHooks('postDatabaseCloseTransaction', get_defined_vars());
return $invariantRulesHold;
}