Example #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));
     }
 }
Example #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));
     }
 }
Example #3
0
 /**
  * @param Router $router
  *
  * @return $this
  */
 public function setRouter(Router $router)
 {
     $this->router = $router;
     $this->router->setApplication($this);
     return $this;
 }