/**
  * ClassNotFoundException constructor.
  * @param string $missingClass The missing class as string.
  * @param string $path
  * @param int $code Error-Code, format: 42x (for starship specific errors)
  */
 public function __construct($missingClass, $path = null, $code = 4200)
 {
     $request = new Request();
     ob_start();
     var_dump($request->getRequest());
     $message = "Failed to load class '{$missingClass}' in '{$path}'\nRequest made: " . ob_get_clean();
     return parent::__construct($message, $code);
 }
Beispiel #2
0
 public function addTask()
 {
     $projectId = $this->request_stack["arguments"][0];
     $task = new Task();
     $taskId = $task->setProject(ProjectQuery::create()->findOneById($projectId))->setEmployee(EmployeeQuery::create()->findOneById((new Cookie())->get("employee_id")))->save();
     $redirect = new Request();
     $redirect->redirect("task", "edit", array("id" => $task->getId()));
 }
Beispiel #3
0
 /**
  * Handles the specified request.
  * @param Request $request the request to be handled
  * @return Response the resulting response
  * @throws NotFoundHttpException if the requested route is invalid
  */
 public function handleRequest($request)
 {
     list($route, $params) = $request->resolve();
     try {
         Application::trace("Route requested: '{$route}'", __METHOD__);
         $this->requestedRoute = $route;
         $result = $this->runAction($route, $params);
         if ($result instanceof Response) {
             return $result;
         } else {
             $response = $this->getResponse();
             if ($result !== null) {
                 $response->data = $result;
             }
             return $response;
         }
     } catch (InvalidRouteException $e) {
         throw new NotFoundHttpException('Page not found.', $e->getCode(), $e);
     }
 }
Beispiel #4
0
 public function index()
 {
     $request = new Request();
     $request->redirect("invoice");
 }
Beispiel #5
0
 private function loadController($controller, $action, $args)
 {
     $request = Request::getInstance();
     $template = new Template();
     $template->setParent($this->_layout);
     if ($this->_active_module) {
         $path = "{$this->_active_module['name']}/{$this->_controller}/{$this->_action}.php";
     } else {
         $path = "{$this->_controller}/{$this->_action}.php";
     }
     if ($this->_layout->get('_default')) {
         $path = $this->getConfig()->templates . DS . $path;
     }
     $template->setPath($path);
     if ($controller = $this->initController($controller)) {
         $this->runController($controller, $action, $template, $args);
         if ($this->_force_route) {
             return;
         }
     } else {
         if (!$template->getPath()) {
             return $this->error(404, 'Page not found.');
         }
     }
     $this->_layout->set('content', $template->render());
 }