1
0
mirror of synced 2025-01-31 20:41:44 +03:00

Add yml example to single table inheritance

This commit is contained in:
Richard Shank 2014-05-27 07:47:07 -07:00
parent 20e47ae52d
commit edaeaf48a8

View File

@ -81,30 +81,47 @@ discriminator column is used.
Example:
.. code-block:: php
.. configuration-block::
<?php
namespace MyProject\Model;
.. code-block:: php
/**
* @Entity
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"person" = "Person", "employee" = "Employee"})
*/
class Person
{
// ...
}
/**
* @Entity
*/
class Employee extends Person
{
// ...
}
<?php
namespace MyProject\Model;
/**
* @Entity
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"person" = "Person", "employee" = "Employee"})
*/
class 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: