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).
A small set of classes to make doctrines inheritance mapping more useful.
If you want to use this in Symfony you should take the benkle/doctrine-adoption-bundle instead.
composer require benkle/doctrine-adoption
<?php
$collector = new Benkle\DoctrineAdoption\Collector();
$collector->addAdoptee(ParentEntity::class, ChildEntity::class, 'child');
$eventManager = new EventManager();
$eventManager->addEventListener([Events::loadClassMetadata], new Benkle\DoctrineAdoption\MetadataListener($collector));
$entityManager = EntityManager::create($dbOpts, $config, $eventManager);
Please note:
doctrine executable for
the table creation to work properly.How can I help you explore Laravel packages today?