本文整理汇总了PHP中Propel::configure方法的典型用法代码示例。如果您正苦于以下问题:PHP Propel::configure方法的具体用法?PHP Propel::configure怎么用?PHP Propel::configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel
的用法示例。
在下文中一共展示了Propel::configure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initPropel
/**
* Initializes Propel.
*/
protected function initPropel()
{
if (!file_exists($this['propel.conf'])) {
$this->logger->notice("Propel configuration missing, skipping propel initialization.");
return;
}
// Use Composer autoloader instead of the built-in propel autoloader
\Propel::configure($this['propel.conf']);
$config = \Propel::getConfiguration(\PropelConfiguration::TYPE_OBJECT);
$classmap = array();
$projectClassPath = $this['propel.projectClassPath'];
foreach ($config['classmap'] as $className => $file) {
$classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file;
}
$level = error_reporting(error_reporting() & ~E_USER_WARNING);
\Propel::initialize();
\PropelAutoloader::getInstance()->unregister();
$this->autoloader->addClassMap($classmap);
error_reporting($level);
// Initialize debugging/logging
if ($this['propel.debug']) {
\Propel::getConnection()->useDebug(true);
if ($this['propel.logging']) {
\Propel::setLogger($this->logger);
}
}
}
示例2: initPropel
/**
* Initializes Propel.
*/
private static function initPropel()
{
if (!file_exists(self::$config->curry->propel->conf)) {
self::log("Propel configuration missing, skipping propel initialization.");
return;
}
// Use Composer autoloader instead of the built-in propel autoloader
Propel::configure(self::$config->curry->propel->conf);
$config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
$classmap = array();
$projectClassPath = self::$config->curry->propel->projectClassPath;
foreach ($config['classmap'] as $className => $file) {
$classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file;
}
$level = error_reporting(error_reporting() & ~E_USER_WARNING);
Propel::initialize();
PropelAutoloader::getInstance()->unregister();
self::getAutoloader()->addClassMap($classmap);
error_reporting($level);
// Initialize debugging/logging
if (self::$config->curry->propel->debug) {
Propel::getConnection()->useDebug(true);
if (self::$logger && self::$config->curry->propel->logging) {
Propel::setLogger(self::$logger);
}
}
}