Development

Changeset 6497

You must first sign up to be able to contribute.

Changeset 6497

Show
Ignore:
Timestamp:
12/14/07 07:46:42 (10 months ago)
Author:
fabien
Message:

added a loadConfiguration() method to sfI18N and sfDatabaseManager to load .yml files

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/data/config/factories.yml

    r6365 r6497  
    2828    class: sfI18N 
    2929    param: 
     30      load_configuration: true 
    3031      cache: 
    3132        class: sfFileCache 
  • trunk/lib/config/sfFactoryConfigHandler.class.php

    r4961 r6497  
    149149            $cache = "    \$cache = null;\n"; 
    150150          } 
     151 
     152          $configuration = ''; 
     153          if (isset($parameters['load_configuration']) && $parameters['load_configuration']) 
     154          { 
     155            $configuration = "  \$this->factories['i18n']->loadConfiguration();\n"; 
     156          } 
    151157          $instances[] = sprintf("\n  if (sfConfig::get('sf_i18n'))\n  {\n". 
    152158                     "    \$class = sfConfig::get('sf_factory_i18n', '%s');\n". 
    153159                     "%s". 
    154160                     "    \$this->factories['i18n'] = new \$class(\$this, \$cache);\n". 
     161                     $configuration. 
    155162                     "  }\n" 
    156163                     , $class, $cache 
  • trunk/lib/database/sfDatabaseManager.class.php

    r4961 r6497  
    5050  public function initialize() 
    5151  { 
    52     // load database configuration 
     52    $this->loadConfiguration(); 
     53  } 
     54 
     55  /** 
     56   * Loads database configuration. 
     57   */ 
     58  public function loadConfiguration() 
     59  { 
    5360    require(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/databases.yml')); 
    5461  } 
  • trunk/lib/i18n/sfI18N.class.php

    r6490 r6497  
    4646    $this->cache   = $cache; 
    4747 
    48     include(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/i18n.yml')); 
    49  
    5048    $context->getEventDispatcher()->connect('user.change_culture', array($this, 'listenToChangeCultureEvent')); 
    5149    $context->getEventDispatcher()->connect('controller.change_action', array($this, 'listenToChangeActionEvent')); 
     50  } 
     51 
     52  /** 
     53   * Loads i18n configuration. 
     54   */ 
     55  public function loadConfiguration() 
     56  { 
     57    include(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/i18n.yml')); 
    5258  } 
    5359 
  • trunk/lib/util/sfContext.class.php

    r5398 r6497  
    4242      // setup our database connections 
    4343      $this->factories['databaseManager'] = new sfDatabaseManager(array('auto_shutdown' => false)); 
     44      $this->factories['databaseManager']->loadConfiguration(); 
    4445    } 
    4546