Download the PHP package benkle/doctrine-adoption-bundle without Composer
On this page you can find all versions of the php package benkle/doctrine-adoption-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download benkle/doctrine-adoption-bundle
More information about benkle/doctrine-adoption-bundle
Files in benkle/doctrine-adoption-bundle
Package doctrine-adoption-bundle
Short Description A small set of services to make doctrines inheritance mapping more useful
License MIT
Informations about the package doctrine-adoption-bundle
Doctrine Adoption Bundle
A small set of services to make doctrines inheritance mapping more useful.
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
Usage
Step 1: Define a parent entity
I recommend that you...
- ...use
JOINED
as inheritance type, as you probably want to add children after the database was first created, and updating a large table can be expensive. Plus you'll avoid column name clashes. - ...at least declare the discriminator map with the parent as only entry. Mostly for clarity's sake.
Step 2: Define a child
Step 3: Create a service definition, so your child can be adopted
Just like Twig extensions, your entities should be declared as private services. The parameters are simple:
name
: The tag name (must bebenkle.doctrine.adoption.child
).of
: The full name of the parent class (think child of).discriminator
: The value for the discriminator column.
Step 4: Clear the cache
Step 5: Create or update db
or
All versions of doctrine-adoption-bundle with dependencies
php Version >= 5.6
symfony/dependency-injection Version >=2.8
symfony/http-kernel Version >=2.8
symfony/config Version >=2.8