当前位置: 首页>>代码示例>>PHP>>正文


PHP sfConfig::clear方法代码示例

本文整理汇总了PHP中sfConfig::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP sfConfig::clear方法的具体用法?PHP sfConfig::clear怎么用?PHP sfConfig::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfConfig的用法示例。


在下文中一共展示了sfConfig::clear方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContext

 /**
  * Returns the current application context.
  *
  * @param  bool $forceReload  true to force context reload, false otherwise
  *
  * @return sfContext
  */
 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 = sfContext::createInstance($configuration);
         unset($currentConfiguration);
         if (!$isContextEmpty) {
             sfConfig::clear();
             sfConfig::add($this->rawConfiguration);
         } else {
             $this->rawConfiguration = sfConfig::getAll();
         }
     }
     return $this->context;
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:32,代码来源:sfBrowser.class.php

示例2: _restoreSfConfig

 protected function _restoreSfConfig()
 {
     if (!empty($this->_backupSfConfig)) {
         sfConfig::clear();
         sfConfig::add($this->_backupSfConfig);
     }
 }
开发者ID:66Ton99,项目名称:sfPhpunitPlugin,代码行数:7,代码来源:sfBasePhpunitTestCase.class.php

示例3: remove

 /**
  * Removes a key from symfony config
  */
 public function remove($key)
 {
     $all = sfConfig::getAll();
     unset($all[$key]);
     sfConfig::clear();
     sfConfig::add($all);
     return $this;
 }
开发者ID:palcoprincipal,项目名称:sfLucenePlugin,代码行数:11,代码来源:limeade_sf_config.php

示例4: flushConfigs

 /** Restores all sfConfig values to their state before the current test was
  *   run.
  *
  * @return static
  */
 public function flushConfigs()
 {
     if (isset(self::$_configs)) {
         sfConfig::clear();
         sfConfig::add(self::$_configs);
     } else {
         self::$_configs = sfConfig::getAll();
     }
     return $this;
 }
开发者ID:todofixthis,项目名称:sfJwtPhpUnitPlugin,代码行数:15,代码来源:State.class.php

示例5: execute

 /**
  * Executes the filter chain.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $config = sfConfig::getAll();
     $host = sfContext::getInstance()->getRequest()->getHost();
     foreach ($config as $key => $value) {
         if ($key == 'dm_' . $host) {
             foreach ($value as $subkey => $subval) {
                 $config['dm_' . $subkey] = $subval;
             }
         }
     }
     sfConfig::clear();
     sfConfig::add($config);
     $filterChain->execute();
 }
开发者ID:pycmam,项目名称:neskuchaik.ru,代码行数:20,代码来源:myDomainConfigFilter.class.php

示例6: getContext

 /**
  * Returns the current application context.
  *
  * @param  bool $forceReload  true to force context reload, false otherwise
  *
  * @return sfContext
  */
 public function getContext($forceReload = false)
 {
     if (is_null($this->context) || $forceReload) {
         if (!is_null($this->context)) {
             $currentConfiguration = $this->context->getConfiguration();
             $configuration = ProjectConfiguration::getApplicationConfiguration($currentConfiguration->getApplication(), $currentConfiguration->getEnvironment(), $currentConfiguration->isDebug());
             $this->context = sfContext::createInstance($configuration);
             unset($currentConfiguration);
             sfConfig::clear();
             sfConfig::add($this->rawConfiguration);
         } else {
             $this->context = sfContext::getInstance();
             $this->context->initialize($this->context->getConfiguration());
             $this->rawConfiguration = sfConfig::getAll();
         }
         $this->context->getEventDispatcher()->connect('application.throw_exception', array($this, 'ListenToException'));
         foreach ($this->listeners as $name => $listener) {
             $this->context->getEventDispatcher()->connect($name, $listener);
         }
     }
     return $this->context;
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:29,代码来源:sfBrowser.class.php

示例7: array

// ::get() ::set()
$t->diag('::get() ::set()');
sfConfig::clear();
sfConfig::set('foo', 'bar');
$t->is(sfConfig::get('foo'), 'bar', '::get() returns the value of key config');
$t->is(sfConfig::get('foo1', 'default_value'), 'default_value', '::get() takes a default value as its second argument');
// ::has()
$t->diag('::has()');
sfConfig::clear();
$t->is(sfConfig::has('foo'), false, '::has() returns false if the key config does not exist');
sfConfig::set('foo', 'bar');
$t->is(sfConfig::has('foo'), true, '::has() returns true if the key config exists');
// ::add()
$t->diag('::add()');
sfConfig::clear();
sfConfig::set('foo', 'bar');
sfConfig::set('foo1', 'foo1');
sfConfig::add(array('foo' => 'foo', 'bar' => 'bar'));
$t->is(sfConfig::get('foo'), 'foo', '::add() adds an array of config parameters');
$t->is(sfConfig::get('bar'), 'bar', '::add() adds an array of config parameters');
$t->is(sfConfig::get('foo1'), 'foo1', '::add() adds an array of config parameters');
// ::getAll()
$t->diag('::getAll()');
sfConfig::clear();
sfConfig::set('foo', 'bar');
sfConfig::set('foo1', 'foo1');
$t->is(sfConfig::getAll(), array('foo' => 'bar', 'foo1' => 'foo1'), '::getAll() returns all config parameters');
// ::clear()
$t->diag('::clear()');
sfConfig::clear();
$t->is(sfConfig::get('foo1'), null, '::clear() removes all config parameters');
开发者ID:hunde,项目名称:bsc,代码行数:31,代码来源:sfConfigTest.php

示例8: activate

 public function activate()
 {
     sfConfig::clear();
     sfConfig::add($this->config);
 }
开发者ID:angoenka,项目名称:www,代码行数:5,代码来源:sfApplicationConfiguration.class.php

示例9: tearDown

 /**
  * TearDown
  */
 public function tearDown()
 {
     sfConfig::clear();
     Replica::removeAll();
     Replica::setCacheManager(null);
 }
开发者ID:pycmam,项目名称:sfReplicaThumbnailPlugin,代码行数:9,代码来源:sfReplicaThumbnailTestCase.php

示例10: setUp

 /**
  * setUp method for PHPUnit
  */
 protected function setUp()
 {
     // Init concrete test config && autoload
     sfConfig::clear();
     ProjectConfiguration::getApplicationConfiguration($this->getApplication(), $this->getEnvironment(), $this->isDebug());
     // Object helper
     $this->helper = $this->makeHelper();
     // Custom init
     $this->_initialize();
     // Begin transaction
     if ($conn = $this->getConnection()) {
         $conn->beginTransaction();
     }
     $this->_start();
 }
开发者ID:EasyFinance,项目名称:sfPhpunitPlugin,代码行数:18,代码来源:sfPHPUnitTestCase.php

示例11: buildUrl

 /**
  * Génération brute de l'url cross app, passer par la fonction genUrl de préference (gestion du cache)
  *
  * @static
  * @throws Exception
  * @param string $app
  * @param string $url
  * @param bool $absolute
  * @param string $env
  * @param string $initialInstanceName for test purpose
  * @return mixed
  */
 public static function buildUrl($app, $url, $absolute = false, $env = null, $initialInstanceName = null)
 {
     $initialApp = sfConfig::get('sf_app');
     if ($initialInstanceName == null) {
         $initialInstanceName = $initialApp;
     }
     $initialScriptName = $_SERVER['SCRIPT_NAME'];
     $initialFrontController = basename($initialScriptName);
     $initialConfig = sfConfig::getAll();
     $debug = sfConfig::get('sf_debug');
     //environnement par défaut
     if ($env == null) {
         $env = $initialConfig['sf_environment'];
     }
     //création du contexte
     if (!sfContext::hasInstance($app)) {
         sfConfig::set('sf_factory_storage', 'sfNoStorage');
         // la config de base est restaurée à la fin de la fonction
         sfConfig::set('sf_use_database', false);
         $configuration = ProjectConfiguration::getApplicationConfiguration($app, $env, $debug);
         $context = sfContext::createInstance($configuration, $app);
         unset($configuration);
     } else {
         $context = sfContext::getInstance($app);
     }
     //détermination du front controller
     $finalFrontController = $app;
     if ($env != 'prod') {
         $finalFrontController .= '_' . $env;
     }
     $finalFrontController .= '.php';
     $crossUrl = $context->getController()->genUrl($url, $absolute);
     unset($context);
     //vérrification de l'existence du front controller
     if (!file_exists(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $finalFrontController)) {
         throw new Exception('Le front controller ' . $finalFrontController . ' est introuvable.');
     }
     $crossUrl = str_replace($initialFrontController, $finalFrontController, $crossUrl);
     //retour au context initial
     if ($app !== $initialInstanceName) {
         sfContext::switchTo($initialInstanceName);
         sfConfig::clear();
         sfConfig::add($initialConfig);
     }
     return $crossUrl;
 }
开发者ID:ratibus,项目名称:Crew,代码行数:58,代码来源:crossAppRouting.class.php

示例12: newChart

// ->generate()
$t->diag('->generate()');
$g = newChart(array('user_id' => $ut->getUserId('user_gb_noCars'), 'full_history' => false));
$t->cmp_ok($g->generate(), '===', false, 'If the User has no cars, the chart cannot be generated.');
$g = newChart();
$t->ok($g->generate(), '->generate() Returns data required to build the chart.');
// ->display()
$t->diag('->display()');
$g = newChart(array('user_id' => $ut->getUserId('user_gb_noCars')));
$t->like($g->display(), '/Not enough data/', 'If the User has no cars, a message id displayed instead of the chart.');
$g = newChart();
$t->like($g->display(), '/This function cannot/', 'Even if the User has cars, nothing is generated by ChartBuilder. This task is left to childrens.');
// ->doForceGenerate()
$t->diag('->doForceGenerate()');
$g = newChart();
sfConfig::clear('app_charts_force_generate');
$t->cmp_ok($g->doForceGenerate(), '===', false, '->doForceGenerate() returns false by default');
sfConfig::set('app_charts_force_generate', true);
$t->cmp_ok($g->doForceGenerate(), '===', true, '->doForceGenerate() returns the value set in app_charts_force_generate');
function getData($data = array())
{
    $fields = Doctrine_Core::getTable('Chart')->getFieldNames();
    $defaults = array_combine($fields, array_fill(0, count($fields), null));
    unset($defaults['created_at'], $defaults['updated_at'], $defaults['slug'], $defaults['id']);
    $foreign = array('vehicles_list' => null, 'categories_list' => null);
    $defaults = array_merge($defaults, $foreign);
    return array_merge($defaults, $data);
}
function newChart($data = array(), $options = array(), $attributes = array())
{
    $ut = new otokouTestFunctional(new sfBrowser());
开发者ID:rbolliger,项目名称:otokou,代码行数:31,代码来源:chartBuilderTest.php


注:本文中的sfConfig::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。