Development

Changeset 4885

You must first sign up to be able to contribute.

Changeset 4885

Show
Ignore:
Timestamp:
08/22/07 18:37:38 (2 years ago)
Author:
fabien
Message:

removed sfActionStack::(g|s)etViewInstance methods and sfContext::getCurrentViewInstance() and replaced them with a 'view_instance' object stored in sfContext (this removes the dependency between the action stack and the view sub-system)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/action/sfActionStackEntry.class.php

    r3198 r4885  
    2525    $actionName     = null, 
    2626    $moduleName     = null, 
    27     $presentation   = null, 
    28     $viewInstance   = null; 
     27    $presentation   = null; 
    2928 
    3029  /** 
     
    6362 
    6463  /** 
    65    * Retrieves this entry's view instance. 
    66    * 
    67    * @return sfView A sfView implementation instance. 
    68    */ 
    69   public function getViewInstance() 
    70   { 
    71     return $this->viewInstance; 
    72   } 
    73  
    74   /** 
    75    * Sets this entry's view instance. 
    76    * 
    77    * @param sfView A sfView implementation instance. 
    78    */ 
    79   public function setViewInstance($viewInstance) 
    80   { 
    81     $this->viewInstance = $viewInstance; 
    82   } 
    83  
    84   /** 
    8564   * Retrieves this entry's module name. 
    8665   * 
  • trunk/lib/helper/AssetHelper.php

    r3777 r4885  
    232232function decorate_with($layout) 
    233233{ 
    234   $view = sfContext::getInstance()->getActionStack()->getLastEntry()->getViewInstance(); 
    235234  if (false === $layout) 
    236235  { 
    237     $view->setDecorator(false); 
     236    sfContext::getInstance()->get('view_instance')->setDecorator(false); 
    238237  } 
    239238  else 
    240239  { 
    241     $view->setDecoratorTemplate($layout); 
     240    sfContext::getInstance()->get('view_instance')->setDecoratorTemplate($layout); 
    242241  } 
    243242} 
  • trunk/lib/helper/PartialHelper.php

    r4850 r4885  
    5555function get_component_slot($name, $vars = array()) 
    5656{ 
    57   $context = sfContext::getInstance(); 
    58  
    59   $actionStackEntry = $context->getController()->getActionStack()->getLastEntry(); 
    60   $viewInstance     = $actionStackEntry->getViewInstance(); 
     57  $viewInstance = sfContext::getInstance()->get('view_instance'); 
    6158 
    6259  if (!$viewInstance->hasComponentSlot($name)) 
  • trunk/lib/util/sfContext.class.php

    r4845 r4885  
    219219 
    220220  /** 
    221    * Retrieve the current view instance for this context. 
    222    * 
    223    * @return sfView The currently view instance, if one is set, 
    224    *                otherwise null. 
    225    */ 
    226   public function getCurrentViewInstance() 
    227   { 
    228     // get the last action stack entry 
    229     if ($this->factories['actionStack'] && $lastEntry = $this->factories['actionStack']->getLastEntry()) 
    230     { 
    231       return $lastEntry->getViewInstance(); 
    232     } 
    233   } 
    234  
    235   /** 
    236221   * Retrieve the request. 
    237222   * 
  • trunk/lib/view/sfPHPView.class.php

    r4603 r4885  
    9393  { 
    9494    // store our current view 
    95     $actionStackEntry = $this->context->getActionStack()->getLastEntry(); 
    96     if (!$actionStackEntry->getViewInstance()) 
    97     { 
    98       $actionStackEntry->setViewInstance($this); 
    99     } 
     95    $this->context->set('view_instance', $this); 
    10096 
    10197    // require our configuration 
  • trunk/lib/view/sfViewCacheManager.class.php

    r4850 r4885  
    587587  public function setPageCache($uri) 
    588588  { 
    589     if (sfView::RENDER_CLIENT != $this->context->getController()->getRenderMode()) 
     589    if (sfView::RENDER_CLIENT != $this->controller->getRenderMode()) 
    590590    { 
    591591      return; 
     
    620620    $cachedResponse = unserialize($retval); 
    621621 
    622     $controller = $this->context->getController(); 
    623     if (sfView::RENDER_VAR == $controller->getRenderMode()) 
    624     { 
    625       $controller->getActionStack()->getLastEntry()->setPresentation($cachedResponse->getContent()); 
     622    if (sfView::RENDER_VAR == $this->controller->getRenderMode()) 
     623    { 
     624      $this->controller->getActionStack()->getLastEntry()->setPresentation($cachedResponse->getContent()); 
    626625      $this->response->setContent(''); 
    627626    } 

The Sensio Labs Network

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