本文整理汇总了PHP中AuthManager::getAuth方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthManager::getAuth方法的具体用法?PHP AuthManager::getAuth怎么用?PHP AuthManager::getAuth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthManager
的用法示例。
在下文中一共展示了AuthManager::getAuth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFormBacker
/**
* This is the on-enter callback for the "form" state
* It will load the object needed to back the form.
* @param $action
* @param $flowScope
*/
public function loadFormBacker($action, &$flowScope)
{
$registry = Zend_Registry::getInstance();
$translate = $registry->get("Zend_Translate");
// Default to using the id from the $flowScope
$id = @$flowScope['authid'];
// If that is empty then we use the one from the request
if (empty($id)) {
$id = $this->_getParam("id");
}
if (empty($id)) {
throw new Zend_Controller_Action_Exception($translate->translate('Resource Not Found'), 404);
}
$howMany = !isset($flowScope['howMany']) ? "1" : $flowScope['howMany'];
$flowScope['howMany'] = $howMany;
// Set the id is the flowscope
$flowScope['authid'] = $id;
$auth = @$flowScope['auth'];
/**
* If the id is "create" and we haven't filled out the form before
* then we need to create a new Auth and set some defaults
*/
if ($id === "create" && $auth === null) {
$auth = new Auth();
$auth->id = $id;
$auth->type = AuthType::$AUTHKEY;
if (isset($flowScope['preSelectedAuthType'])) {
$auth->type = $flowScope['preSelectedAuthType'];
$flowScope['authTypeLocked'] = true;
}
$auth->apiContext = "actx";
$auth->policyContext = "pctx";
$flowScope['isNew'] = true;
} else {
if ($auth === null) {
$authManager = new AuthManager();
$auth = $authManager->getAuth($id);
$flowScope['isNew'] = false;
$flowScope["relatedProperties"] = JsonPropertyPrinter::getRelatedFromAuth($auth);
}
}
/**
* Put the auth in the flow scope for reference by other states and the views
*/
$flowScope['auth'] = $auth;
}