本文整理匯總了PHP中dm::createContext方法的典型用法代碼示例。如果您正苦於以下問題:PHP dm::createContext方法的具體用法?PHP dm::createContext怎麽用?PHP dm::createContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dm
的用法示例。
在下文中一共展示了dm::createContext方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getContext
/**
* Diem override:
* sfContext is hardcoded in symfony unit tests.
* Replace it with dmContext.
*
* @see sfBrowser
*/
public function getContext($forceReload = false)
{
if (null === $this->context || $forceReload) {
$isContextEmpty = null === $this->context;
$context = $isContextEmpty ? sfContext::getInstance() : $this->context;
// create configuration
$currentConfiguration = $context->getConfiguration();
$configuration = ProjectConfiguration::getApplicationConfiguration($currentConfiguration->getApplication(), $currentConfiguration->getEnvironment(), $currentConfiguration->isDebug());
// connect listeners
$configuration->getEventDispatcher()->connect('application.throw_exception', array($this, 'listenToException'));
foreach ($this->listeners as $name => $listener) {
$configuration->getEventDispatcher()->connect($name, $listener);
}
// create context
$this->context = dm::createContext($configuration);
unset($currentConfiguration);
if (!$isContextEmpty) {
sfConfig::clear();
sfConfig::add($this->rawConfiguration);
} else {
$this->rawConfiguration = sfConfig::getAll();
}
}
return $this->context;
}
示例2: boot
protected function boot()
{
$configuration = ProjectConfiguration::getApplicationConfiguration($this->options['app'], $this->options['env'], $this->options['debug']);
$this->context = dm::createContext($configuration);
sfConfig::set('sf_logging_enabled', false);
// remove all cache
sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
}
示例3: getContext
public function getContext()
{
if (null === $this->context) {
if (!dmContext::hasInstance()) {
$this->logSection('diem', sprintf('Loading %s...', get_class($this->configuration)));
dm::createContext($this->configuration);
}
$this->context = dmContext::getInstance();
}
return $this->context;
}
示例4: getContext
/**
* Get the current context
* @return dmContext
*/
public function getContext()
{
if (null === $this->context) {
if (!dmContext::hasInstance()) {
$this->logSection('Diem Extended', sprintf('Loading %s...', get_class($this->configuration)));
dm::createContext($this->configuration);
}
$this->context = dmContext::getInstance();
$this->context->get('filesystem')->setFormatter($this->formatter);
}
return $this->context;
}
示例5: dirname
<?php
require_once dirname(__FILE__) . '/../config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('front', 'prod', false);
dm::createContext($configuration)->dispatch();
示例6: debug_backtrace
<?php
// guess current application
if (!isset($app)) {
$traces = debug_backtrace();
$caller = $traces[0];
$dirPieces = explode(DIRECTORY_SEPARATOR, dirname($caller['file']));
$app = array_pop($dirPieces);
}
require_once dirname(__FILE__) . '/../../config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true);
dm::createContext($configuration);
// remove all cache
sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));