We will now import the shows database. To do so, create a new
Symfony project, import the database and configure your
.env file.
symfony new --webapp shows
Run the command:
symfony console make:entity --regenerate
to automatically generate all the accessors on the entity classes, whose properties have restricted visibility.
We will now generate a class controller, based on the Series entity. To do so,
use the command:
symfony console make:crud
Look at the generated code (src/Controller/SeriesController.php as well as templates/series/*)
Modify the index() action of SeriesController to limit the number of results. You can
use the findBy function.
Modify the code to remove the unnecessary methods (here, we don't want to delete, edit or add a series, for example).
Add the poster of a series to its page (when clicking on "show").
/series/poster/{id}, which will actually be the poster of the seriesgetPoster() is a stream, you will have to call
stream_get_contents() to read itResponse.Display the list of seasons of a series on its page ("show"), sorted by number.