/**
  * Route the given route path
  *
  * This command takes a given path and displays the detected route and
  * the selected package, controller and action.
  *
  * @param string $path The route path to resolve
  * @return void
  */
 public function routePathCommand($path)
 {
     $this->initializeRouter();
     foreach ($this->router->getRoutes() as $route) {
         if ($route->matches($path) === TRUE) {
             $routeValues = $route->getMatchResults();
             if (!isset($routeValues['@subpackage'])) {
                 $routeValues['@subpackage'] = '';
             }
             $this->outputLine('<b>Path:</b>');
             $this->outputLine('  ' . $path);
             $this->outputLine('<b>Route:</b>');
             $this->outputLine('  Name: ' . $route->getName());
             $this->outputLine('  Pattern: ' . $route->getUriPattern());
             $this->outputLine('<b>Result:</b>');
             $this->outputLine('  Package: ' . $routeValues['@package']);
             $this->outputLine('  Subpackage: ' . $routeValues['@subpackage']);
             $this->outputLine('  Controller: ' . $routeValues['@controller']);
             $this->outputLine('  Action: ' . $routeValues['@action']);
             $this->outputLine('  Format: ' . $routeValues['@format']);
             $controllerObjectName = $this->router->getControllerObjectName($routeValues['@package'], $routeValues['@subpackage'], $routeValues['@controller']);
             if ($controllerObjectName !== NULL) {
                 $this->outputLine('<b>Controller:</b>');
                 $this->outputLine('  ' . $controllerObjectName);
             } else {
                 $this->outputLine('<b>Controller Error:</b>');
                 $this->outputLine('  !!! No Controller Object found !!!');
             }
             return;
         }
     }
     $this->outputLine('No matching Route was found');
 }
Exemple #2
0
 /**
  * Try to get the controller object name from the given $routeValues and throw an exception, if it can't be resolved.
  *
  * @param array $routeValues
  * @return void
  * @throws \TYPO3\FLOW3\Mvc\Routing\Exception\InvalidControllerException
  */
 protected function throwExceptionIfTargetControllerDoesNotExist(array $routeValues)
 {
     $packageKey = isset($routeValues['@package']) ? $routeValues['@package'] : '';
     $subPackageKey = isset($routeValues['@subpackage']) ? $routeValues['@subpackage'] : '';
     $controllerName = isset($routeValues['@controller']) ? $routeValues['@controller'] : '';
     $controllerObjectName = $this->router->getControllerObjectName($packageKey, $subPackageKey, $controllerName);
     if ($controllerObjectName === NULL) {
         throw new Exception\InvalidControllerException('No controller object was found for package "' . $packageKey . '", subpackage "' . $subPackageKey . '", controller "' . $controllerName . '" in route "' . $this->getName() . '".', 1301650951);
     }
 }