Mini Library Course #3: Database, Entities & Migrations with Doctrine

Our app runs and has a template. Now it needs data. In this chapter we connect Symfony to a MySQL database, create our three entities (Author, Category and Book), link them together, and create the tables with migrations. What you'll learn Configure the MySQL connection in Symfony Create entities with make:entity, field by field Link entities: ManyToOne and ManyToMany Turn entities into tables with migrations Configuring the Database The connection is configured in the .env file at the root of the project. Symfony already ships with a few commented examples (SQLite, MySQL, MariaDB, PostgreSQL). We use MySQL, so we uncomment the MySQL line and comment out the others. ...

November 18, 2026 · 5 min · 968 words · Naimi

Mini Library Course #11: File Uploads Done Right in EasyAdmin

We left two problems open: the file paths aren’t saved, and deleted books leave their files on disk. There’s also a hidden bug in our “year_month” folder system. This chapter fixes all three. What you'll learn Spot the hidden bug of a path computed at display time Save each file’s path in the database at upload time Override persistEntity, updateEntity and deleteEntity Delete old files without any risk of data loss The Hidden Bug in Our Path System In chapter 9, we computed the upload folder from the current date, directly in configureFields(): ...

November 18, 2026 · 5 min · 938 words · Naimi