当前位置: 首页>>代码示例>>PHP>>正文


PHP DBALException::driverRequired方法代码示例

本文整理汇总了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']);
     }
 }
开发者ID:pollux1er,项目名称:dlawebdev2,代码行数:21,代码来源:DriverManager.php

示例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;
 }
开发者ID:sharenjoy,项目名称:axes,代码行数:30,代码来源:DriverManager.php


注:本文中的Doctrine\DBAL\DBALException::driverRequired方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。