diff --git a/app/Controller/HelloWorldController.php b/app/Controller/HelloWorldController.php index ef7a807..0e708a0 100644 --- a/app/Controller/HelloWorldController.php +++ b/app/Controller/HelloWorldController.php @@ -59,4 +59,17 @@ class HelloWorldController 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"); + } } \ No newline at end of file