Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

SymfonyCasts

Symfony, Doctrine Relations & Warp Drive Basics

via SymfonyCasts

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it

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 Relations
  • ManyToMany with extra data on the join table

Your mission: tackle Doctrine relationships... without crashing the ship. You got this!

Syllabus

  • Setup
  • Part Entity
  • Many To One: The King of Relationships
  • Setting the Relation
  • Setting Relations in Foundry
  • Fetching a Relation's Data
  • The Two Sides of a Relation: Owning vs Inverse
  • Orphan Removal
  • Ordering a Relation and "fetch" type
  • The Clever Criteria System
  • Listing Parts
  • Joining to Avoid the N+1 Trap
  • Adding a Search + the Request Object
  • Droid Entity for the ManyToMany Relationship
  • Many-To-Many Relationship
  • Setting Many To Many Relations
  • Accessing Data on a ManyToMany
  • Many To Many with Foundry
  • Joining Across a Many-to-Many Relationship
  • Many-to-Many but with Extra Data
  • Persisting the More Complex Many-to-Many Relationship
  • Hiding the Join Entity
  • Re-adding addDroid(): Hide that Join Entity!
  • Cascade Persist

Taught by

Ryan Weaver and Kevin Bond

Reviews

Start your review of Symfony, Doctrine Relations & Warp Drive Basics

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.