diff --git a/src/Controller/StarshipController.php b/src/Controller/StarshipController.php new file mode 100644 index 0000000..c836483 --- /dev/null +++ b/src/Controller/StarshipController.php @@ -0,0 +1,24 @@ +}', name: 'app_starship_show')] + public function show(int $id, StarshipRepository $repository): Response + { + $ship = $repository->findOne($id); + if (null === $ship) { + throw $this->createNotFoundException('Starship not found'); + } + + return $this->render('starship/show.html.twig', [ + 'ship' => $ship, + ]); + } +} \ No newline at end of file diff --git a/templates/main/homepage.html.twig b/templates/main/homepage.html.twig index 9c6ef23..55aa4b2 100644 --- a/templates/main/homepage.html.twig +++ b/templates/main/homepage.html.twig @@ -2,4 +2,8 @@ {% block body %} {{ variable }} + + Ship 01 + Ship 02 + Ship 03 (not found) {% endblock %} diff --git a/templates/starship/show.html.twig b/templates/starship/show.html.twig new file mode 100644 index 0000000..195df77 --- /dev/null +++ b/templates/starship/show.html.twig @@ -0,0 +1,20 @@ +{% extends 'base.html.twig' %} + +{% block title %}{{ ship.name }}{% endblock %} + +{% block body %} +

{{ ship.name }}

+ + + + + + + + + + + + +
Class{{ ship.class }}
Captain{{ ship.captain }}
+{% endblock %} \ No newline at end of file