$name]); } #[Route('/routes')] public function routes(RoutesConfig $config): ViewInterface { return new RouteView($config); } #[Route('/world/{name}')] public function world(string $name): ResponseInterface { return new GenericResponse("Hello $name!"); } #[Route('/db')] public function db(EntityManager $em): ResponseInterface { $repo = $em->getRepository(Book::class); dump($repo->findAll()); return new GenericResponse("DB stuff"); } #[Route('/create')] public function createDb(EntityManager $em): ResponseInterface { $books = $em->getRepository(Book::class)->findAll(); $book = new Book(); $book->setTitle(sprintf('Book %d', count($books) + 1)); $em->persist($book); $em->flush(); dump($book); return new GenericResponse("DB stuff"); } }