Doctrine 2: To Use or Not to Use
summary
Doctrine delivers the easy 80%: CRUD, associations, DQL and lazy loading, but hits limits on inheritance, events, batch imports and complex read models. Expect hydration to dominate cost (SQL 5–10ms, PHP hydration 100–200ms) and flushes to slow dramatically as the UnitOfWork grows beyond ~100 entities per UnitOfWork. Workarounds include modeling changes or view models instead of entities, using getConnection raw SQL or the DB query builder, storing JSON/custom types for flexible fields, and preferring explicit domain events over generic listeners.
AI-written summary · about
chapters (12)
- 0:00Introduction to Doctrine debate
- 3:26ORM limitations and expectations
- 10:18When to use Doctrine effectively
- 17:19Advanced features and risks
- 19:47Inheritance mapping pitfalls
- 24:49Events and performance issues
- 27:39Batch processing challenges
- 31:11DQL fetch joins and pagination
- 35:50Raw SQL alternatives
- 39:46Domain-driven design with Doctrine
- 40:59Future of Doctrine
- 43:05Q&A on multi-master connections
