YoVDO

Mastering Doctrine Relations

Offered By: SymfonyCasts

Tags

Doctrine Courses Web Development Courses Symfony Courses

Course Description

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

  • 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

Related Courses

API Platform 3 Part 3: Custom Resources
SymfonyCasts
API Platform 3 Part 2: Security for your Treasures
SymfonyCasts
Dependency Injection and the art of services and containers
SymfonyCasts
EasyAdmin! For an Awesomely Powerful Admin Area
SymfonyCasts
EasyAdminBundle v1 for an Amazing Admin Interface
SymfonyCasts