Merge pull request #1039 from iampersistent/patch-1
Add yml example to single table inheritance
This commit is contained in:
commit
466808bf48
@ -81,30 +81,47 @@ discriminator column is used.
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
.. code-block:: php
|
.. configuration-block::
|
||||||
|
|
||||||
<?php
|
.. code-block:: php
|
||||||
namespace MyProject\Model;
|
|
||||||
|
|
||||||
/**
|
<?php
|
||||||
* @Entity
|
namespace MyProject\Model;
|
||||||
* @InheritanceType("SINGLE_TABLE")
|
|
||||||
* @DiscriminatorColumn(name="discr", type="string")
|
/**
|
||||||
* @DiscriminatorMap({"person" = "Person", "employee" = "Employee"})
|
* @Entity
|
||||||
*/
|
* @InheritanceType("SINGLE_TABLE")
|
||||||
class Person
|
* @DiscriminatorColumn(name="discr", type="string")
|
||||||
{
|
* @DiscriminatorMap({"person" = "Person", "employee" = "Employee"})
|
||||||
// ...
|
*/
|
||||||
}
|
class Person
|
||||||
|
{
|
||||||
/**
|
// ...
|
||||||
* @Entity
|
}
|
||||||
*/
|
|
||||||
class Employee extends Person
|
/**
|
||||||
{
|
* @Entity
|
||||||
// ...
|
*/
|
||||||
}
|
class Employee extends Person
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
MyProject\Model\Person:
|
||||||
|
type: entity
|
||||||
|
inheritanceType: SINGLE_TABLE
|
||||||
|
discriminatorColumn:
|
||||||
|
name: discr
|
||||||
|
type: string
|
||||||
|
discriminatorMap:
|
||||||
|
person: Person
|
||||||
|
employee: Employee
|
||||||
|
|
||||||
|
MyProject\Model\Employee:
|
||||||
|
type: entity
|
||||||
|
|
||||||
Things to note:
|
Things to note:
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user