Esempio n. 1
0
 public function update(Book $book)
 {
     try {
         $this->service->update($book);
         return $this->view->render('books/books', ['books' => $this->service->getAll()]);
     } catch (ValidationExceptionInterface $exc) {
         return $this->view->render('books/edit', ['book' => $book, '_exception' => $exc]);
     }
 }
 public function onKernelException(GetResponseForExceptionEvent $e)
 {
     $ex = $e->getException();
     $response = new Response();
     if ($ex instanceof NotFoundHttpException) {
         $response->setContent($this->view->render('error/404'));
         $e->setResponse($response);
         return;
     }
     if ($this->debugMode) {
         \Symfony\Component\Debug\ExceptionHandler::register();
         throw $ex;
     }
     $response->setContent($this->view->render('error/exception'));
     $e->setResponse($response);
     $this->logger->handleException($ex);
 }
Esempio n. 3
0
 public function getIndexPage()
 {
     return $this->view->render('hello-world');
 }