Magento 2 Experten — Hyvä Theme, Tailwind CSS & SEO aus einer Hand ›

Block 5 Summary: Relationships & Complex Resources

Block 5 Summary: Relationships & Complex Resources

~16 Min. Lesezeit Zuletzt aktualisiert am August 8, 2026

Block 5 is COMPLETE. Two ISOLATED entities have become a COMPLETE, connected domain model – EXACTLY the core data set of the task manager.

What block 5 covered

  • Chapter 37: the Task entity with ManyToOne to Project.
  • Chapter 38: the inverse OneToMany side on Project.
  • Chapter 39: nested collections via uriVariables/Link.
  • Chapter 40: IRI vs. embedded objects, controlled deliberately via groups.
  • Chapter 41: error cases when linking, creating via the nested endpoint.
  • Chapter 42: ManyToMany between Task and Tag.
  • Chapter 43: filtering by relationships, including tags[] for multiple values.
  • Chapter 44: cascade/orphanRemoval for clean deletion.
  • Chapter 45: deliberately avoiding circular references.

Project state at the end of block 5

api/src/ – state after chapter 45

api/
└── src/
    ├── Entity/
    │   ├── Project.php   ← OneToMany tasks (cascade, orphanRemoval)
    │   ├── Task.php      ← ManyToOne project, ManyToMany tags
    │   └── Tag.php       ← ManyToMany tasks (inverse, read-only)
    ├── Filter/
    │   └── MultiFieldSearchFilter.php
    ├── Dto/
    │   └── ProjectSummary.php
    ├── Validator/
    │   ├── UniqueProjectName.php
    │   └── UniqueProjectNameValidator.php
    └── DataFixtures/
        └── AppFixtures.php  ← projects, tags, tasks with relationships

Apply it yourself: linking Status to Task

If the Status exercise from chapter 18/28 was completed: add a ManyToOne relationship from Task to Status (analogous to project from chapter 37), following EXACTLY the same pattern.

Achtung: EXACTLY as with the previous exercises: NOT assumed for later chapters – block 6 builds INDEPENDENTLY of it, on top of the current state of Project/Task/Tag.

What's coming in block 6

So far, the ENTIRE API is PUBLIC – ANYONE can read, edit, and delete ANY project. Block 6 (chapters 47-56) introduces a User entity, JWT authentication, and Voter-based access control – EXACTLY the security chapter of the Symfony course (chapters 34-43), now applied to API Platform.

Tipp: A good moment to go through all 46 chapters SO FAR once, completely: doctrine:database:drop --force && doctrine:database:create && doctrine:migrations:migrate --no-interaction && doctrine:fixtures:load --no-interaction rebuilds the database COMPLETELY FROM SCRATCH, a good test of whether ALL migrations work in the CORRECT order.