Changeset 25012

Show
Ignore:
Timestamp:
02/04/10 14:38:04 (1 month ago)
Author:
bergie
Message:

Validate route selection in dispatcher, not in templating

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midgardmvc/midgardmvc_core/services/dispatcher/manual.php

    r24958 r25012  
    6262    { 
    6363        $route_definitions = $this->get_routes(); 
     64        if (!isset($route_definitions[$this->midgardmvc->context->route_id])) 
     65        { 
     66            throw new Exception("Route {$route_id} not defined for component {$this->midgardmvc->context->component}"); 
     67        } 
    6468 
    6569        $selected_route_configuration = $route_definitions[$this->midgardmvc->context->route_id]; 
  • trunk/midgardmvc/midgardmvc_core/services/templating/midgard.php

    r24979 r25012  
    359359        // Then initialize the component, so it also goes to template stack 
    360360        $this->dispatcher->initialize($request); 
    361          
    362         $routes = $this->midgardmvc->configuration->normalize_routes(); 
    363         $component_name = $this->midgardmvc->context->component; 
    364  
    365         if (!isset($routes[$route_id])) 
    366         { 
    367             throw new Exception("Route {$route_id} not defined for component {$component_name}"); 
    368         } 
    369361 
    370362        $this->dispatcher->set_route($route_id, $arguments); 
    371363        $this->dispatcher->dispatch(); 
    372          
     364 
     365        $component_name = $this->midgardmvc->context->component;         
    373366        $data = $this->midgardmvc->context->$component_name; 
    374367