Development

Changeset 8290

You must first sign up to be able to contribute.

Changeset 8290

Show
Ignore:
Timestamp:
04/04/08 16:38:37 (1 year ago)
Author:
fabien
Message:

added a dispatcher as a constructor argument for configuration classes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/config/sfApplicationConfiguration.class.php

    r8274 r8290  
    2828   * Constructor. 
    2929   * 
    30    * @param string  The environment name 
    31    * @param Boolean true to enable debug mode 
    32    * @param string  The project root directory 
    33    */ 
    34   public function __construct($environment, $debug, $rootDir = null) 
     30   * @param string            The environment name 
     31   * @param Boolean           true to enable debug mode 
     32   * @param string            The project root directory 
     33   * @param sfEventDispatcher An event dispatcher 
     34   */ 
     35  public function __construct($environment, $debug, $rootDir = null, sfEventDispatcher $dispatcher = null) 
    3536  { 
    3637    $this->environment = $environment; 
     
    3839    $this->application = str_replace('Configuration', '', get_class($this)); 
    3940 
    40     parent::__construct($rootDir); 
     41    parent::__construct($rootDir, $dispatcher); 
    4142 
    4243    $this->configure(); 
  • branches/1.1/lib/config/sfProjectConfiguration.class.php

    r7962 r8290  
    2929   * Constructor. 
    3030   */ 
    31   public function __construct($rootDir = null
     31  public function __construct($rootDir = null, sfEventDispatcher $dispatcher = null
    3232  { 
    3333    sfProjectConfiguration::$active = $this; 
    34  
    3534    $this->rootDir = is_null($rootDir) ? self::guessRootDir() : realpath($rootDir); 
    3635 
     
    4140    sfCoreAutoload::register(); 
    4241 
    43     $this->dispatcher = new sfEventDispatcher()
     42    $this->dispatcher = is_null($dispatcher) ? new sfEventDispatcher() : $dispatcher
    4443 
    4544    ini_set('magic_quotes_runtime', 'off'); 
     
    264263   * Returns a sfApplicationConfiguration configuration for a given application. 
    265264   * 
    266    * @param string  An application name 
    267    * @param string  The environment name 
    268    * @param Boolean true to enable debug mode 
    269    * @param string  The project root directory 
     265   * @param string            An application name 
     266   * @param string            The environment name 
     267   * @param Boolean           true to enable debug mode 
     268   * @param string            The project root directory 
     269   * @param sfEventDispatcher An event dispatcher 
    270270   * 
    271271   * @return sfApplicationConfiguration A sfApplicationConfiguration instance 
    272272   */ 
    273   static public function getApplicationConfiguration($application, $environment, $debug, $rootDir = null
     273  static public function getApplicationConfiguration($application, $environment, $debug, $rootDir = null, sfEventDispatcher $dispatcher = null
    274274  { 
    275275    $class = $application.'Configuration'; 
     
    278278    { 
    279279      // force initialization of sf_apps_dir config setting 
    280       new ProjectConfiguration(); 
     280      new ProjectConfiguration(null, $dispatcher); 
    281281    } 
    282282 
     
    288288    } 
    289289 
    290     return new $class($environment, $debug, $rootDir); 
     290    return new $class($environment, $debug, $rootDir, $dispatcher); 
    291291  } 
    292292} 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/bootstrap/functional.php

    r7962 r8290  
    2323$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 
    2424sfContext::createInstance($configuration); 
     25$dispatcher = $configuration->getEventDispatcher(); 
    2526 
    2627// remove all cache 
     
    4041{ 
    4142  chdir(sfConfig::get('sf_root_dir')); 
    42   $task = new sfPropelBuildModelTask(new sfEventDispatcher(), new sfFormatter()); 
     43  $task = new sfPropelBuildModelTask($dispatcher, new sfFormatter()); 
    4344  ob_start(); 
    4445  $task->run(); 
     
    5051{ 
    5152  chdir(sfConfig::get('sf_root_dir')); 
    52   $task = new sfPropelBuildSqlTask(new sfEventDispatcher(), new sfFormatter()); 
     53  $task = new sfPropelBuildSqlTask($dispatcher, new sfFormatter()); 
    5354  ob_start(); 
    5455  $task->run(); 
     
    6061{ 
    6162  chdir(sfConfig::get('sf_root_dir')); 
    62   $task = new sfPropelBuildFormsTask(new sfEventDispatcher(), new sfFormatter()); 
     63  $task = new sfPropelBuildFormsTask($dispatcher, new sfFormatter()); 
    6364  $task->run(); 
    6465} 
  • branches/1.1/lib/task/sfBaseTask.class.php

    r7962 r8290  
    3737 
    3838      require_once sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php'; 
    39       $this->configuration = ProjectConfiguration::getApplicationConfiguration($application, 'test', true); 
     39      $this->configuration = ProjectConfiguration::getApplicationConfiguration($application, 'test', true, null, $this->dispatcher); 
    4040    } 
    4141    else 
     
    4444      { 
    4545        require_once sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php'; 
    46         $this->configuration = new ProjectConfiguration(); 
     46        $this->configuration = new ProjectConfiguration(null, $this->dispatcher); 
    4747      } 
    4848      else 
    4949      { 
    50         $this->configuration = new sfProjectConfiguration(getcwd()); 
     50        $this->configuration = new sfProjectConfiguration(getcwd(), $this->dispatcher); 
    5151      } 
    5252    } 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.