当前位置: 首页>>代码示例>>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;未经允许,请勿转载。