Product Decisions This Supports
- Database Schema Flexibility: Enables dynamic inheritance mapping in Doctrine ORM, allowing teams to adopt a strategy pattern for entity relationships without rigid schema constraints. Ideal for products with modular architectures (e.g., plugins, extensible SaaS) where child entities inherit from parent schemas but require custom behavior.
- Roadmap for Legacy Systems: Justifies technical debt reduction by retrofitting inheritance hierarchies in monolithic PHP/Laravel apps without full refactoring. Example: A legacy e-commerce platform could use this to map
Product → DigitalProduct/PhysicalProduct without altering existing tables.
- Build vs. Buy: Buy if your team lacks bandwidth to build custom Doctrine event listeners or if you need quick validation of inheritance mappings. Avoid reinventing the wheel for common use cases like polymorphic queries or shared table inheritance.
- Use Cases:
- Multi-tenancy: Dynamically map tenant-specific child entities to shared parent schemas.
- Feature Flags: Toggle entity inheritance at runtime (e.g.,
User → PremiumUser).
- Data Migration: Safely transition from single-table to class-table inheritance.
When to Consider This Package
-
Adopt if:
- Your Laravel/PHP app uses Doctrine ORM (not Eloquent) and needs inheritance mapping beyond Doctrine’s defaults.
- You’re working with complex entity hierarchies (e.g., >3 levels deep) where manual
@InheritanceType annotations are cumbersome.
- Your team prioritizes developer velocity over custom solutions for schema inheritance.
- You’re not using Symfony (use the bundle instead).
-
Look elsewhere if:
- You’re using Eloquent ORM (this is Doctrine-specific).
- Your inheritance needs are simple (e.g., single-level, no dynamic mapping).
- You require automatic table creation (this requires custom Doctrine CLI setup).
- Your stack is fully managed (e.g., Laravel Forge/SaaS databases) where schema changes are restricted.
- You need active maintenance (package has 0 stars; vet for long-term viability).
How to Pitch It (Stakeholders)
For Executives:
"This package lets our engineering team simplify database inheritance for complex entity relationships—like mapping parent-child schemas dynamically—without rewriting core Doctrine logic. It’s a lightweight, MIT-licensed solution that could accelerate development for [specific feature/roadmap item], reducing the risk of schema migrations. Think of it as ‘Lego blocks’ for database tables: swap out child entities without breaking the parent structure. Low risk, high reward for modularity."
For Engineering:
*"If we’re using Doctrine ORM and need to dynamically map inheritance (e.g., for plugins or multi-tenancy), this package cuts weeks of custom listener development. Key trade-offs:
- Pros: No reinventing Doctrine event listeners; works with existing schemas.
- Cons: Requires manual Doctrine CLI setup for table creation; untested at scale (0 stars).
Recommendation: Pilot for [use case X] and compare to a custom solution. If it works, we can adopt it for [roadmap items Y/Z]."*
For Developers:
*"This is a Doctrine event listener that lets you define inheritance mappings at runtime, e.g.,:
$collector->addAdoptee(Parent::class, Child::class, 'child');
Useful if you’re tired of hardcoding @InheritanceType or need to dynamically switch child entities. Downside: You’ll need to modify your Doctrine CLI setup for migrations to work. Worth trying if you’re already using Doctrine and want cleaner inheritance logic."*