Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Doctrine Adoption Laravel Package

benkle/doctrine-adoption

Adds a small Collector + Doctrine metadata listener to enhance inheritance mapping by “adopting” child entities into a parent with a named association. Register the loadClassMetadata listener manually (including for schema creation/CLI tools).

View on GitHub
Deep Wiki
Context7

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 ProductDigitalProduct/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., UserPremiumUser).
    • 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."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui