本文整理汇总了PHP中zibo\core\Zibo::runEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Zibo::runEvent方法的具体用法?PHP Zibo::runEvent怎么用?PHP Zibo::runEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zibo\core\Zibo
的用法示例。
在下文中一共展示了Zibo::runEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadConnectionsFromConfig
/**
* Loads the database connections from the Zibo configuration
* @param zibo\core\Zibo $zibo Instance of Zibo
* @return null
* @throws zibo\library\database\exception\DatabaseException when the configuration contains an invalid connection
* @throws zibo\library\database\exception\DatabaseException when the default connection does not exist
*/
private function loadConnectionsFromConfig(Zibo $zibo)
{
$zibo->runEvent(Zibo::EVENT_LOG, 'Loading database connections', '', 0, self::LOG_NAME);
$connections = $zibo->getConfigValue(self::CONFIG_CONNECTION, array());
if (!is_array($connections)) {
$connections = array(self::NAME_DEFAULT => $connections);
}
$defaultConnectionName = null;
foreach ($connections as $name => $dsn) {
if ($name == self::NAME_DEFAULT) {
$defaultConnectionName = $name;
}
try {
$dsn = new Dsn($dsn);
$this->registerConnection($name, $dsn);
} catch (DatabaseException $e) {
if ($name == self::NAME_DEFAULT) {
$defaultConnectionName = $dsn;
} else {
throw $e;
}
}
}
if ($defaultConnectionName != null) {
$this->setDefaultConnectionName($defaultConnectionName);
}
}
示例2: initializeSecurityModel
/**
* Initializes the security model from the Zibo configuration
* @param zibo\core\Zibo $zibo The Zibo instance
* @param zibo\library\ObjectFactory $objectFactory Instance of an object factory
* @return null
*/
private function initializeSecurityModel(Zibo $zibo, ObjectFactory $objectFactory)
{
$modelClass = $zibo->getConfigValue(self::CONFIG_SECURITY_MODEL);
if (!$modelClass) {
return;
}
try {
$this->model = $objectFactory->create($modelClass, self::INTERFACE_SECURITY_MODEL);
$zibo->runEvent(Zibo::EVENT_LOG, 'Using security model ' . $modelClass, '', 0, self::LOG_NAME);
} catch (Exception $e) {
$zibo->runEvent(Zibo::EVENT_LOG, 'Could not create security model ' . $modelClass, $e, 1, self::LOG_NAME);
}
}