Exemplo n.º 1
0
 /**
  * Method to run the application routines.
  *
  * @return  void
  *
  * @since   1.0
  */
 public function doExecute()
 {
     try {
         $controller = $this->router->getController($this->get('uri.route'));
         $controller->execute();
     } catch (\Exception $e) {
         $this->setErrorHeader($e);
         $data = ['error' => true, 'message' => $e->getMessage()];
         $this->setBody(json_encode($data));
     }
 }
Exemplo n.º 2
0
 /**
  * Method to run the application routines.
  *
  * @return  void
  *
  * @since   1.0
  */
 public function doExecute()
 {
     try {
         $controller = $this->router->getController($this->get('uri.route'));
         $controller->execute();
     } catch (\Exception $e) {
         // Log the error for reference
         $this->getLogger()->error($e->getMessage(), ['trace' => $e->getTraceAsString()]);
         $this->setErrorHeader($e);
         $data = ['error' => true, 'message' => $e->getMessage()];
         $this->setBody(json_encode($data));
     }
 }
Exemplo n.º 3
0
 /**
  * @param Router $router
  *
  * @return $this
  */
 public function setRouter(Router $router)
 {
     $this->router = $router;
     $this->router->setApplication($this);
     return $this;
 }