Esempio n. 1
0
 /**
  * Loop through children, rendering each
  * 
  * @param  Model $model 
  * @return void
  */
 protected function renderChildren(Model $model)
 {
     foreach ($model as $child) {
         if ($child->terminate()) {
             throw new Exception\DomainException('Inconsistent state; child view model is marked as terminal');
         }
         $child->setOption('has_parent', true);
         $result = $this->render($child);
         $child->setOption('has_parent', null);
         $capture = $child->captureTo();
         if (!empty($capture)) {
             $model->setVariable($capture, $result);
         }
     }
 }
Esempio n. 2
0
 /**
  * Inject the controller and controller class into the model
  *
  * If either $displayExceptions or $displayNotFoundReason are enabled,
  * injects the controllerClass from the MvcEvent. It checks to see if a
  * controller is present in the MvcEvent, and, if not, grabs it from
  * the route match if present; if a controller is found, it injects it into
  * the model.
  *
  * @param  ViewModel $model
  * @param  MvcEvent $e
  * @return void
  */
 protected function injectController($model, $e)
 {
     if (!$this->displayExceptions() && !$this->displayNotFoundReason()) {
         return;
     }
     $controller = $e->getController();
     if (empty($controller)) {
         $routeMatch = $e->getRouteMatch();
         if (empty($routeMatch)) {
             return;
         }
         $controller = $routeMatch->getParam('controller', false);
         if (!$controller) {
             return;
         }
     }
     $controllerClass = $e->getControllerClass();
     $model->setVariable('controller', $controller);
     $model->setVariable('controller_class', $controllerClass);
 }