當前位置: 首頁>>代碼示例>>PHP>>正文


PHP dm::createContext方法代碼示例

本文整理匯總了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;
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:32,代碼來源:dmSfBrowser.php

示例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'));
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:8,代碼來源:dmCoreFunctionalCoverageTest.php

示例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;
 }
開發者ID:jdart,項目名稱:diem,代碼行數:11,代碼來源:dmContextTask.php

示例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;
 }
開發者ID:runopencode,項目名稱:diem-extended,代碼行數:16,代碼來源:dmContextTask.php

示例5: dirname

<?php

require_once dirname(__FILE__) . '/../config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('front', 'prod', false);
dm::createContext($configuration)->dispatch();
開發者ID:theolymp,項目名稱:diem,代碼行數:5,代碼來源:index.php

示例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'));
開發者ID:theolymp,項目名稱:diem,代碼行數:14,代碼來源:functional.php


注:本文中的dm::createContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。