1
0
mirror of synced 2024-12-14 15:16:04 +03:00
doctrine2/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Company.CompanyPerson.dcm.xml
2012-04-15 15:40:43 -03:00

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">
<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>
<discriminator-map >
<discriminator-mapping value="person" class="CompanyPerson" />
<discriminator-mapping value="manager" class="CompanyManager" />
<discriminator-mapping value="employee" class="CompanyEmployee" />
</discriminator-map>
<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>