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

SymfonyCasts

Doctrine Collections: ManyToMany, Forms & other Complex Relations

via SymfonyCasts

Overview

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.

Syllabus

  • Give me Clean URL Strings (slugs!)
  • DoctrineExtensions: Sluggable
  • Refactoring Carefully
  • ManyToMany Relationship
  • Inserting into a ManyToMany
  • Fetching Items from a ManyToMany Collection
  • ManyToMany: The Inverse Side of the Relationship
  • Removing a ManyToMany Item
  • Hooking up the Scientist Removal JavaScript
  • ManyToMany & Fixtures
  • Joining Across a ManyToMany + EXTRA_LAZY Fetch
  • EntityType Checkboxes with ManyToMany
  • Saving the Inverse Side of a ManyToMany
  • Form by_reference + Adder and Remover
  • Synchronizing Owning & Inverse Sides
  • ManyToMany with Extra Fields
  • Join Entity App Refactoring
  • Using the new OneToMany Collections
  • Embedded Form: CollectionType
  • Collection Delete & allow_delete
  • Deleting an Item from a Collection: orphanRemoval
  • CollectionType: Adding New with the Prototype
  • Adding to a Collection: Cascade Persist
  • Embedded Form Validation with @Valid
  • Customizing the Collection Form Prototype
  • Form Events: A readonly Embedded Field
  • Collection Filtering: The Easy Way
  • Criteria System: Champion Collection Filtering

Taught by

Ryan Weaver

Reviews

Start your review of Doctrine Collections: ManyToMany, Forms & other Complex 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.