Modeling inheritance in your code is natural - but how does that translate to your database?
We're excited to announce a new SymfonyCasts course:
👉 Doctrine Inheritance: Class Hierarchy in the Database
In this course, we explore how Doctrine ORM handles inheritance and how to map class hierarchies to your database in a clean, efficient way. You'll learn the different strategies available, when to use each one, and the trade-offs involved.
By the end, you'll be able to confidently model complex relationships using inheritance and understand exactly how Doctrine is handling things behind the scenes.
What This Course Covers
This course takes a practical, example-driven approach to one of Doctrine's more advanced topics.
Some of the key topics include:
- Understanding the concept of inheritance in Doctrine ORM
- Using mapped superclasses for shared fields and behavior
- Implementing single table inheritance (STI) and how it works internally
- Exploring joined table inheritance and when it makes sense
- Comparing inheritance strategies and choosing the right one for your use case
- Querying across inheritance hierarchies with DQL
- Working with associations that target parent or child classes
- Understanding limitations and edge cases of inheritance mappings
And in a special bonus chapter, we go even further:
- Extending Doctrine with a custom DQL function to work around a real limitation when querying inheritance hierarchies
The goal is not just to understand the features, but to know when - and when not - to use them.
Who Is This For?
This course is perfect if you:
- Use Doctrine ORM and want to model more complex domain logic
- Have encountered inheritance in Doctrine but aren't fully confident using it
- Want to understand the trade-offs between different mapping strategies
- Have hit limitations with Doctrine queries and want to go deeper
If inheritance in Doctrine has ever felt confusing or full of hidden pitfalls, this course will help make it clear and predictable.
What's Next on SymfonyCasts?
If you enjoy going deeper into Symfony and Doctrine internals, there's more on the way.
We're currently working on two upcoming courses:
- Symfony Security: The Basics – a practical introduction to Symfony's security system, covering authentication, login forms, user providers, and core security concepts.
- Upgrading to Symfony 8 – a focused guide to upgrading your applications, including key changes, deprecations, and modern best practices.
Stay tuned - there are more deep dives into the tools you and I use every day coming soon!