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. ...