With the basic of Doctrine relations behind us, it's time to dive deeper and get our hands dirty with some real-world, but complex collections. Honestly, this is the hardest part of Doctrine: so let's get it right:
- Creating ManyToMany associations
- Querying on ManyToMany relations
- Mapping the inverse (collection) side of a relation
- (bonus) Using DoctrineExtension for clean URL slugs
- Keeping the owning & inverse sides in-sync
- Using orphanRemoval to delete items in a collection
- Using cascade to save items in a collection
- Counting collections in the EXTRA_LAZY way
- Rendering relationship data from both sides
- Filtering collections efficiently with Criteria (mind will be blown)
- Dealing with complex collection forms
- Adding "extra" data to the "join table"
Doctrine relationships take a little bit more work to get setup. So let's master this stuff, setup our relationships to win, and get back to work.