當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。