57 lines
2.5 KiB
XML
57 lines
2.5 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
|
|
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
|
|
|
|
<entity name="Doctrine\Tests\Models\Company\CompanyPerson" table="company_persons" inheritance-type="JOINED">
|
|
|
|
<discriminator-map >
|
|
<discriminator-mapping value="person" class="CompanyPerson" />
|
|
<discriminator-mapping value="manager" class="CompanyManager" />
|
|
<discriminator-mapping value="employee" class="CompanyEmployee" />
|
|
</discriminator-map>
|
|
|
|
<named-native-queries>
|
|
<named-native-query name="fetchAllWithResultClass" result-class="__CLASS__">
|
|
<query>SELECT id, name, discr FROM company_persons ORDER BY name</query>
|
|
</named-native-query>
|
|
|
|
<named-native-query name="fetchAllWithSqlResultSetMapping" result-set-mapping="mappingFetchAll">
|
|
<query>SELECT id, name, discr AS discriminator FROM company_persons ORDER BY name</query>
|
|
</named-native-query>
|
|
</named-native-queries>
|
|
|
|
<sql-result-set-mappings>
|
|
<sql-result-set-mapping name="mappingFetchAll">
|
|
<entity-result entity-class="__CLASS__" discriminator-column="discriminator">
|
|
<field-result name="id"/>
|
|
<field-result name="name"/>
|
|
</entity-result>
|
|
</sql-result-set-mapping>
|
|
</sql-result-set-mappings>
|
|
|
|
<id name="id" type="integer" column="id">
|
|
<generator strategy="AUTO"/>
|
|
</id>
|
|
|
|
<field name="name" column="name"/>
|
|
|
|
<one-to-one field="spouse" target-entity="CompanyPerson">
|
|
<join-column name="spouse_id" referenced-column-name="id"/>
|
|
</one-to-one>
|
|
|
|
<many-to-many field="friends" target-entity="CompanyPerson">
|
|
<join-table name="company_persons_friends">
|
|
<join-columns>
|
|
<join-column name="person_id" referenced-column-name="id"/>
|
|
</join-columns>
|
|
<inverse-join-columns>
|
|
<join-column name="friend_id" referenced-column-name="id"/>
|
|
</inverse-join-columns>
|
|
</join-table>
|
|
</many-to-many>
|
|
</entity>
|
|
|
|
</doctrine-mapping> |