本文整理汇总了PHP中Propel::adapterMap方法的典型用法代码示例。如果您正苦于以下问题:PHP Propel::adapterMap方法的具体用法?PHP Propel::adapterMap怎么用?PHP Propel::adapterMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel
的用法示例。
在下文中一共展示了Propel::adapterMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initAdapters
/**
* Setup the adapters needed. An adapter must be defined for each database connection.
* Generally the adapter will be the same as the PEAR phpname; e.g. for MySQL, use the
* 'mysql' adapter.
* @param array $configuration the Configuration representing the properties file
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
private static function initAdapters($configuration)
{
self::$adapterMap = array();
$c = isset($configuration['datasources']) ? $configuration['datasources'] : null;
if (!empty($c)) {
try {
foreach ($c as $handle => $properties) {
if (is_array($properties) && isset($properties['adapter'])) {
$db = DBAdapter::factory($properties['adapter']);
// register the adapter for this name
self::$adapterMap[$handle] = $db;
}
}
} catch (Exception $e) {
throw new PropelException("Unable to initialize adapters.", $e);
}
} else {
self::log("There were no adapters in the configuration.", self::LOG_WARNING);
}
}