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

SymfonyCasts

Symfony 5: Mastering Doctrine Relations

via SymfonyCasts

Overview

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

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!

Syllabus

  • The Answer Entity
  • The ManyToOne Relation
  • Saving Relations
  • Relations in Foundry
  • Foundry: Always Pass a Factory Instance to a Relation
  • Fetching Relations
  • Rendering Answer Data & Saving Votes
  • Owning Vs Inverse Sides of a Relation
  • Relation OrderBy & fetch=EXTRA_LAZY
  • Filtering to Return only Approved Answers
  • Collection Criteria for Custom Relation Queries
  • Most Popular Answers Page
  • The |u Filter & String Component
  • Joining Across a Relationship & The N + 1 Problem
  • Search, the Request Object & OR Query Logic
  • The 4 (2?) Possible Relation Types
  • ManyToMany Relation
  • Saving Items in a ManyToMany Relation
  • Handling ManyToMany in Foundry
  • Joining Across a ManyToMany
  • ManyToMany... with Extra Fields on the Join Table?
  • When a Migration Falls Apart
  • QuestionTag Fixtures & DateTimeImmutable with Faker
  • Doing Crazy things with Foundry & Fixtures
  • JOINing Across Multiple Relationships
  • Pagination with Pagerfanta
  • Themed Pagination Links

Taught by

Ryan Weaver

Reviews

Start your review of Symfony 5: Mastering Doctrine Relations

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.