本文整理汇总了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;
}