本文整理汇总了PHP中Icinga\Data\ResourceFactory::setConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceFactory::setConfig方法的具体用法?PHP ResourceFactory::setConfig怎么用?PHP ResourceFactory::setConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icinga\Data\ResourceFactory
的用法示例。
在下文中一共展示了ResourceFactory::setConfig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setResourceConfig
/**
* Set the resource configuration to use
*
* @param array $config
*
* @return $this
*/
public function setResourceConfig(array $config)
{
$resourceConfig = new Config();
$resourceConfig->setSection($config['name'], $config);
ResourceFactory::setConfig($resourceConfig);
$this->config = $config;
return $this;
}
示例2: createElements
/**
* Create and add elements to this form
*
* @param array $formData
*/
public function createElements(array $formData)
{
// LdapUserGroupBackendForm requires these factories to provide valid configurations
ResourceFactory::setConfig($this->createResourceConfiguration());
UserBackend::setConfig($this->createBackendConfiguration());
$backendForm = new LdapUserGroupBackendForm();
$formData['type'] = 'ldap';
$backendForm->create($formData);
$backendForm->getElement('name')->setValue('icingaweb2');
$this->addSubForm($backendForm, 'backend_form');
$backendForm->addElement('hidden', 'resource', array('required' => true, 'value' => $this->resourceConfig['name'], 'decorators' => array('ViewHelper')));
$backendForm->addElement('hidden', 'user_backend', array('required' => true, 'value' => $this->backendConfig['name'], 'decorators' => array('ViewHelper')));
}
示例3: setupResourceFactory
/**
* Set up the resource factory
*
* @return $this
*/
protected function setupResourceFactory()
{
try {
$config = Config::app('resources');
ResourceFactory::setConfig($config);
} catch (NotReadableError $e) {
Logger::error(new IcingaException('Cannot load resource configuration. An exception was thrown:', $e));
}
return $this;
}
示例4: createUserGroupBackend
/**
* Create and return the user group backend
*
* @return LdapUserGroupBackend
*/
protected function createUserGroupBackend()
{
$resourceConfig = new Config();
$resourceConfig->setSection($this->resourceConfig['name'], $this->resourceConfig);
ResourceFactory::setConfig($resourceConfig);
$backendConfig = new Config();
$backendConfig->setSection($this->backendConfig['name'], array_merge($this->backendConfig, array('resource' => $this->resourceConfig['name'])));
UserBackend::setConfig($backendConfig);
if (empty($this->groupConfig)) {
$groupConfig = new ConfigObject(array('backend' => $this->backendConfig['backend'], 'resource' => $this->resourceConfig['name'], 'user_backend' => $this->backendConfig['name']));
} else {
$groupConfig = new ConfigObject($this->groupConfig);
}
$backend = UserGroupBackend::create(null, $groupConfig);
if (!$backend instanceof Selectable) {
throw new NotImplementedError('Unsupported, until #9772 has been resolved');
}
return $backend;
}