Development

Changeset 6663

You must first sign up to be able to contribute.

Changeset 6663

Show
Ignore:
Timestamp:
12/21/07 08:45:11 (8 months ago)
Author:
fabien
Message:

removed parameter holder dependency for routing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/routing/sfNoRouting.class.php

    r4892 r6663  
    3232 
    3333    // module/action 
    34     $module = isset($parameters['module']) ? $parameters['module'] : $this->parameterHolder->get('default_module')
    35     $action = isset($parameters['action']) ? $parameters['action'] : $this->parameterHolder->get('default_action')
     34    $module = isset($parameters['module']) ? $parameters['module'] : $this->options['default_module']
     35    $action = isset($parameters['action']) ? $parameters['action'] : $this->options['default_action']
    3636 
    3737    // other parameters 
  • branches/1.1/lib/routing/sfPathInfoRouting.class.php

    r4892 r6663  
    3333  { 
    3434    $parameters = $this->currentRouteParameters; 
    35     $module = isset($parameters['module']) ? $parameters['module'] : $this->parameterHolder->get('default_module')
    36     $action = isset($parameters['action']) ? $parameters['action'] : $this->parameterHolder->get('default_action')
     35    $module = isset($parameters['module']) ? $parameters['module'] : $this->options['default_module']
     36    $action = isset($parameters['action']) ? $parameters['action'] : $this->options['default_action']
    3737 
    3838    // other parameters 
  • branches/1.1/lib/routing/sfPatternRouting.class.php

    r6661 r6663  
    3434   * 
    3535   * @param  sfEventDispatcher A sfEventDispatcher instance 
    36    * @param  array        An associative array of initialization parameters. 
     36   * @param  array        An associative array of initialization options. 
    3737   * 
    3838   * @return Boolean      true, if initialization completes successfully, otherwise false. 
     
    4040   * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRouting. 
    4141   */ 
    42   public function initialize(sfEventDispatcher $dispatcher, $parameters = array()) 
    43   { 
    44     parent::initialize($dispatcher, $parameters); 
    45  
    46     $this->setDefaultSuffix($this->parameterHolder->get('suffix')); 
     42  public function initialize(sfEventDispatcher $dispatcher, $options = array()) 
     43  { 
     44    parent::initialize($dispatcher, $options); 
     45 
     46    $this->setDefaultSuffix(isset($options['suffix']) ? $options['suffix'] : ''); 
    4747  } 
    4848 
     
    8585      else 
    8686      { 
    87         $module = isset($parameters['module']) && $parameters['module'] ? $parameters['module'] : $this->parameterHolder->get('default_module')
    88         $action = isset($parameters['action']) && $parameters['action'] ? $parameters['action'] : $this->parameterHolder->get('default_action')
     87        $module = isset($parameters['module']) && $parameters['module'] ? $parameters['module'] : $this->options['default_module']
     88        $action = isset($parameters['action']) && $parameters['action'] ? $parameters['action'] : $this->options['default_action']
    8989 
    9090        $internalUri = $module.'/'.$action; 
     
    169169  public function clearRoutes() 
    170170  { 
    171     if ($this->parameterHolder->get('logging')
     171    if ($this->options['logging']
    172172    { 
    173173      $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Clear all current routes'))); 
     
    330330    } 
    331331 
    332     if ($this->parameterHolder->get('logging')
     332    if ($this->options['logging']
    333333    { 
    334334      $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Connect "%s"%s', $route, $suffix ? ' ("'.$suffix.'" suffix)' : '')))); 
     
    581581          $this->currentInternalUri = null; 
    582582 
    583           if ($this->parameterHolder->get('logging')
     583          if ($this->options['logging']
    584584          { 
    585585            $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Match route [%s] "%s"', $routeName, $route)))); 
     
    594594    if (!$break) 
    595595    { 
    596       if ($this->parameterHolder->get('logging')
     596      if ($this->options['logging']
    597597      { 
    598598        $this->dispatcher->notify(new sfEvent($this, 'application.log', array('No matching route found'))); 
  • branches/1.1/lib/routing/sfRouting.class.php

    r6510 r6663  
    2222    $dispatcher        = null, 
    2323    $defaultParameters = array(), 
    24     $parameterHolder   = null
     24    $options           = array()
    2525 
    2626  /** 
     
    2929   * @see initialize() 
    3030   */ 
    31   public function __construct(sfEventDispatcher $dispatcher, $parameters = array()) 
     31  public function __construct(sfEventDispatcher $dispatcher, $options = array()) 
    3232  { 
    33     $this->initialize($dispatcher, $parameters); 
     33    $this->initialize($dispatcher, $options); 
    3434 
    35     if ($this->parameterHolder->get('auto_shutdown', true)
     35    if (isset($this->options['auto_shutdown']) && $this->options['auto_shutdown']
    3636    { 
    3737      register_shutdown_function(array($this, 'shutdown')); 
     
    4343   * 
    4444   * @param  sfEventDispatcher A sfEventDispatcher instance 
    45    * @param  array        An associative array of initialization parameters. 
     45   * @param  array        An associative array of initialization options. 
    4646   * 
    4747   * @return Boolean     true, if initialization completes successfully, otherwise false. 
     
    4949   * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRouting. 
    5050   */ 
    51   public function initialize(sfEventDispatcher $dispatcher, $parameters = array()) 
     51  public function initialize(sfEventDispatcher $dispatcher, $options = array()) 
    5252  { 
    5353    $this->dispatcher = $dispatcher; 
    5454 
    55     if (!isset($parameters['default_module'])) 
     55    if (!isset($options['default_module'])) 
    5656    { 
    57       $parameters['default_module'] = 'default'; 
     57      $options['default_module'] = 'default'; 
    5858    } 
    5959 
    60     if (!isset($parameters['default_action'])) 
     60    if (!isset($options['default_action'])) 
    6161    { 
    62       $parameters['default_action'] = 'index'; 
     62      $options['default_action'] = 'index'; 
    6363    } 
    6464 
    65     $this->parameterHolder = new sfParameterHolder(); 
    66     $this->parameterHolder->add($parameters); 
     65    if (!isset($options['logging'])) 
     66    { 
     67      $options['logging'] = false; 
     68    } 
     69 
     70    $this->options = $options; 
    6771 
    6872    $this->dispatcher->connect('user.change_culture', array($this, 'listenToChangeCultureEvent'));