本文整理匯總了PHP中ConnectionManager::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConnectionManager::get方法的具體用法?PHP ConnectionManager::get怎麽用?PHP ConnectionManager::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ConnectionManager
的用法示例。
在下文中一共展示了ConnectionManager::get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testClosureConnection
public function testClosureConnection()
{
ConnectionManager::add(function () {
return "closure";
}, "closure");
$this->assertEquals("closure", ConnectionManager::get("closure"));
}
示例2: _getSchema
/**
* Helper method to get the schema collection.
*
* @return false|\Cake\Database\Schema\Collection
*/
protected function _getSchema()
{
$source = ConnectionManager::get($this->params['connection']);
if (!method_exists($source, 'schemaCollection')) {
$msg = sprintf('The "%s" connection is not compatible with orm caching, ' . 'as it does not implement a "schemaCollection()" method.', $this->params['connection']);
$this->error($msg);
return false;
}
$config = $source->config();
if (empty($config['cacheMetadata'])) {
$this->_io->verbose('Metadata cache was disabled in config. Enabling to clear cache.');
$source->cacheMetadata(true);
}
return $source->schemaCollection();
}