本文整理匯總了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);
}
}