本文整理匯總了PHP中Propel::initConfiguration方法的典型用法代碼示例。如果您正苦於以下問題:PHP Propel::initConfiguration方法的具體用法?PHP Propel::initConfiguration怎麽用?PHP Propel::initConfiguration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Propel
的用法示例。
在下文中一共展示了Propel::initConfiguration方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initPropel
/**
* Initialize a Propel connection to the database
*
* @param bool $root wheter to also initialize a root connection
* @return the Propel connection
*/
public function initPropel($root = false)
{
if ($this->initPropel && !$root || $this->initPropelRoot && $root) {
return;
}
$wfDetails = $this->getDBCredentials("wf");
$rbDetails = $this->getDBCredentials("rb");
$rpDetails = $this->getDBCredentials("rp");
$config = array('datasources' => array('workflow' => array('connection' => $wfDetails["dsn"], 'adapter' => $wfDetails["adapter"]), 'rbac' => array('connection' => $rbDetails["dsn"], 'adapter' => $rbDetails["adapter"]), 'rp' => array('connection' => $rpDetails["dsn"], 'adapter' => $rpDetails["adapter"])));
if ($root) {
$dbHash = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
$dbInfo = $this->getDBInfo();
$host = $dbHash[0];
$user = $dbHash[1];
$pass = $dbHash[2];
$dbName = $dbInfo["DB_NAME"];
$rootConfig = array('datasources' => array('root' => array('connection' => "mysql://{$user}:{$pass}@{$host}/{$dbName}?encoding=utf8", 'adapter' => "mysql")));
$config["datasources"] = array_merge($config["datasources"], $rootConfig["datasources"]);
$this->initPropelRoot = true;
}
$this->initPropel = true;
require_once "propel/Propel.php";
require_once "creole/Creole.php";
Propel::initConfiguration($config);
}