Download the PHP package ojezu/configurable-discrimination-bundle without Composer
On this page you can find all versions of the php package ojezu/configurable-discrimination-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ojezu/configurable-discrimination-bundle
More information about ojezu/configurable-discrimination-bundle
Files in ojezu/configurable-discrimination-bundle
Package configurable-discrimination-bundle
Short Description Symfony2 bundle that allows configuring Doctrine discrimination maps in children bundles.
License MIT
Informations about the package configurable-discrimination-bundle
OJezu/ConfigurableDiscriminationBundle
This Bundle solves Doctrine problem with inheritance: discriminatorMap has to be declared on parent entity, and has to have all children declared in it. If you leave it empty, Doctrine will scan ALL files to look for classes that extend the parent class, and will auto-generate entries for them in discriminatorMap along with discriminator values - over which programmer in that case has absolutely no control - they will be derived from name of child class and that's it.
That is especially nasty, if some of the children classes are in other bundles, programmer has to make the parent bundle aware of all the child classes!
This Bundle allows specifying discriminator values and children classes in child bundle configuration - making the code of parent bundle clear of any references to children bundles, avoids scanning all class files in search of children classes and allows specifying custom discriminator values.
Installation
Usage
Register this bundle in app/appKernel.php:
In ParentBundle:
You have to declare non-empty discriminatorMap or otherwise Doctrine will try to auto-generate it. OJezu/ConfigurableDiscriminationBundle will only add entries to it.
In ChildABundle:
Add some faux-services tagged with ojezu.configurable_discrimination
to your
bundle internal config so that OJezu/ConfigurableDiscriminationBundle can read
your custom configuration.
Name of the service does not matter.
Acme\AcmeChildA\Entity\AcmeChildA
of course must be defined, and directly
extend Acme\AcmeParent\Entity\AcmeParent
In ChildBBundle:
Acknowledgments
Thanks to https://github.com/sredni who helped me to get into Symfony and did some code reviewing of this package.
This package is somewhat based on DCSDynamicDiscriminatorMapBundle and on Defining Discriminator Maps at Child-level in Doctrine 2
License
MIT
All versions of configurable-discrimination-bundle with dependencies
symfony/dependency-injection Version ^3.0 || ^2.7
symfony/http-kernel Version ^3.0 || ^2.7
symfony/config Version ^3.0 || ^2.7