1
0
mirror of synced 2025-01-10 11:07:10 +03:00

Merge pull request #1039 from iampersistent/patch-1

Add yml example to single table inheritance
This commit is contained in:
Marco Pivetta 2014-05-27 16:56:08 +02:00
commit 466808bf48

View File

@ -81,29 +81,46 @@ 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
{
// ...
}
<?php
namespace MyProject\Model;
/**
* @Entity
*/
class Employee extends Person
{
// ...
}
/**
* @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: