本文整理汇总了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);
}