In the part 1 of the Doctrine Tutorial we got some serious work done with Doctrine: creating entity classes, making custom queries, migrations, Docker setup & more!
But... we ignored one of the biggest part of Doctrine: relations / associations! And thanks to tooling inside of Symfony, creating database relationships - ManyToOne, ManyToMany, etc - has never been easier. So let's go!
- Generating a ManyToOne relationship (association)
- Relation annotations / PHP 8 attributes
- The OneToMany inverse side of a relation
- Handling relationships in fixtures with Foundry
- The owning versus inverse sides of a relation
- Doing magic with the ArrayCollection (Criteria)
- Querying with Joins
- ManyToMany Relations
So let's cook up some relationships and take our Cauldron Overflow app to the next level!