本文整理匯總了PHP中Doctrine\DBAL\DBALException::driverRequired方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBALException::driverRequired方法的具體用法?PHP DBALException::driverRequired怎麽用?PHP DBALException::driverRequired使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\DBAL\DBALException
的用法示例。
在下文中一共展示了DBALException::driverRequired方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _checkParams
/**
* Checks the list of parameters.
*
* @param array $params
*/
private static function _checkParams(array $params)
{
// check existance of mandatory parameters
// driver
if (!isset($params['driver']) && !isset($params['driverClass'])) {
throw DBALException::driverRequired();
}
// check validity of parameters
// driver
if (isset($params['driver']) && !isset(self::$_driverMap[$params['driver']])) {
throw DBALException::unknownDriver($params['driver'], array_keys(self::$_driverMap));
}
if (isset($params['driverClass']) && !in_array('Doctrine\\DBAL\\Driver', class_implements($params['driverClass'], true))) {
throw DBALException::invalidDriverClass($params['driverClass']);
}
}
示例2: parseDatabaseUrlScheme
/**
* Parses the scheme part from given connection URL and resolves the given connection parameters.
*
* @param array $url The connection URL parts to evaluate.
* @param array $params The connection parameters to resolve.
*
* @return array The resolved connection parameters.
*
* @throws DBALException if parsing failed or resolution is not possible.
*/
private static function parseDatabaseUrlScheme(array $url, array $params)
{
if (isset($url['scheme'])) {
// The requested driver from the URL scheme takes precedence
// over the default custom driver from the connection parameters (if any).
unset($params['driverClass']);
// URL schemes must not contain underscores, but dashes are ok
$driver = str_replace('-', '_', $url['scheme']);
// The requested driver from the URL scheme takes precedence
// over the default driver from the connection parameters (if any).
$params['driver'] = isset(self::$driverSchemeAliases[$driver]) ? self::$driverSchemeAliases[$driver] : $driver;
return $params;
}
// If a schemeless connection URL is given, we require a default driver or default custom driver
// as connection parameter.
if (!isset($params['driverClass']) && !isset($params['driver'])) {
throw DBALException::driverRequired($params['url']);
}
return $params;
}