dev-master
9999999-dev https://github.com/jankstudio/catalyst-discriminator-map-bundleCatalyst Doctrine Discriminator Map Bundle
MIT
The Requires
by Kendrick Chan
doctrine discriminator
Catalyst Doctrine Discriminator Map Bundle
Symfony bundle that allows the specification of Doctrine discriminator maps in bundle configuration files instead of under the parent entity., (*1)
This bundle removes the dependency of the parent entity on the children entities., (*2)
Minimum requirement is to have a dmap.yml file under the Resources/config directory of the bundle with the parent entity., (*3)
Sample dmap.yml file:, (*4)
entities: - parent: MyBundle\Entity\Person children: - id: person class: MyBundle\Entity\Person - id: employee class: MyBundle\Entity\Employee
You can have other dmap.yml files with the same parent entity in other bundles like so:, (*5)
entities: - parent: MyBundle\Entity\Person children: - id: customer class: AnotherBundle\Entity\Customer
Entity:, (*6)
<?php namespace MyProject\Entity; /** * @Entity * @InheritanceType("SINGLE_TABLE") * @DiscriminatorColumn(name="discr", type="string") * @DiscriminatorMap({"person" = "Person", "employee" = "Employee"}) */ class Person { // ... } /** * @Entity */ class Employee extends Person { // ... }
Entity:, (*7)
<?php namespace MyProject\Entity; /** * @Entity * @InheritanceType("SINGLE_TABLE") * @DiscriminatorColumn(name="discr", type="string") */ class Person { // ... } /** * @Entity */ class Employee extends Person { // ... }
Configuration File (dmap.yml):, (*8)
entities: - parent: MyProject\Entity\Person children: - id: person class: MyProject\Entity\Person - id: employee class: MyProject\Entity\Employee
Catalyst Doctrine Discriminator Map Bundle
MIT
doctrine discriminator