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

SymfonyCasts

Mastering Doctrine Relations

via SymfonyCasts

Overview

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

  • 01. The Answer Entity
  • 02. The ManyToOne Relation
  • 03. Saving Relations
  • 04. Relations in Foundry
  • 05. Foundry: Always Pass a Factory Instance to a Relation
  • 06. Fetching Relations
  • 07. Rendering Answer Data & Saving Votes
  • 08. Owning Vs Inverse Sides of a Relation
  • 09. Relation OrderBy & fetch=EXTRA_LAZY
  • 10. Filtering to Return only Approved Answers
  • 11. Collection Criteria for Custom Relation Queries
  • 12. Most Popular Answers Page
  • 13. The |u Filter & String Component
  • 14. Joining Across a Relationship & The N + 1 Problem
  • 15. Search, the Request Object & OR Query Logic
  • 16. The 4 (2?) Possible Relation Types
  • 17. ManyToMany Relation
  • 18. Saving Items in a ManyToMany Relation
  • 19. Handling ManyToMany in Foundry
  • 20. Joining Across a ManyToMany
  • 21. ManyToMany... with Extra Fields on the Join Table?
  • 22. When a Migration Falls Apart
  • 23. QuestionTag Fixtures & DateTimeImmutable with Faker
  • 24. Doing Crazy things with Foundry & Fixtures
  • 25. JOINing Across Multiple Relationships
  • 26. Pagination with Pagerfanta
  • 27. Themed Pagination Links

Taught by

Ryan Weaver

Reviews

Start your review of 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.