This course is still being released! Check back later for more chapters.
Symfony, Doctrine Relations & Warp Drive Basics
Add dimensions to your app with database relations! Maybe you have many hive-minded aliens all related to one collective. Resistance to Doctrine relations is futile! Besides
About this course
This course is in the planning stages
In the part 1 of the Doctrine Tutorial we did some seriously cool stuff done with Doctrine (we've earned 🍦 imo). We created entity classes (thanks make:entity
!), made custom queries, migrations, set up Docker & more!
But... we ignored one of the biggest part of Doctrine: relations / associations! Thankfully, creating database relationships - ManyToOne, ManyToMany, etc - has never been easier and Doctrine handles a ton of the work for us.
Lift off in T minus... just start already! 🚀
- Generating the famous
ManyToOne
relationship (association) - Setting relationship (forget the foreign keys, it's all about the objects!
- Handling relationships in fixtures with Foundry
- The
OneToMany
"inverse" side of a relation - Filtering a collection of related objects with
Criteria
orphanRemoval
(not as heartless as it sounds!)- Querying with Joins
- Solving the N+1 problem
ManyToMany
RelationsManyToMany
with extra data on the join table
Your mission: tackle Doctrine relationships... without crashing the ship. You got this!
Next courses in the Symfony 7: The Fundamentals section of the Symfony 7 Track!
2 Comments

Hey @Tac-Tacelosky
Thank you for your input! I'll share it with the team
Cheers!
I'm really hoping Doctrine ORM 3.4 comes out soon, so we can use Property Hooks. This makes lazy-loading MUCH easier, and will allow us to get rid of lots of boilerplate setters/getters.
Please consider including that functionality with this course. I know not everyone has PHP 8.4, but for those that do it'll be great to learn best practices for how to code. https://www.doctrine-project.org/blog/index.html has more about what's going to be in 3.4, and as they say "The lazy objects RFC in PHP 8.4 changes everything for the better in Doctrine ORM internally". I looks forward to learning the best practices for Doctrine Relations, especially with the context of API Platform and the Symfony Serializer.