本文整理匯總了PHP中Connection::getConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::getConfig方法的具體用法?PHP Connection::getConfig怎麽用?PHP Connection::getConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Connection
的用法示例。
在下文中一共展示了Connection::getConfig方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
if (is_null($this->table)) {
$database = Connection::getConfig($this->connection);
$this->table = $database['prefix'] . Inflector::underscore(get_class($this));
}
$this->loadBehaviors($this->behaviors);
}
示例2: __construct
/**
* 構造方法
*
* @param Connection $connection
* @param string|null $databaseName 數據庫名,默認使用連接中的數據庫
*/
public function __construct(Connection $connection, $databaseName = null)
{
$this->connection = $connection;
$this->dbConfig = $connection->getConfig();
if (!$databaseName) {
$databaseName = $this->dbConfig['dbname'];
}
$this->explainSchema($databaseName);
}
示例3: install_models
function install_models(Connection $connection, $package, $models)
{
$factory = RelationFactory::getInstance();
$factory->prepareRelations($package, $models);
$models = $factory->getRelations($connection->getConfig()->getType());
foreach ($models as $model) {
if (!install_model($connection, $model)) {
return false;
}
}
return true;
}
示例4: array
<?php
Connection::add(array('development' => array('driver' => 'MySql', 'host' => 'localhost', 'user' => 'root', 'password' => '', 'database' => 'spaghetti', 'prefix' => ''), 'production' => array('driver' => 'MySql', 'host' => 'localhost', 'user' => 'root', 'password' => '', 'database' => 'spaghetti', 'prefix' => ''), 'test' => array('driver' => 'MySql', 'host' => 'localhost', 'user' => 'root', 'password' => '', 'database' => 'spaghetti', 'prefix' => '')));
$env = Config::read('App.environment');
Connection::add('default', Connection::getConfig($env));
示例5: __construct
public function __construct(Connection $connection)
{
$this->connection = $connection;
$params = $connection->getConfig();
parent::__construct($params);
}