本文整理汇总了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;
}