122 lines
5.4 KiB
XML
122 lines
5.4 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\CMS\CmsUser" table="cms_users">
|
|
|
|
<named-queries>
|
|
<named-query name="all" query="SELECT u FROM __CLASS__ u"/>
|
|
</named-queries>
|
|
|
|
<named-native-queries>
|
|
<named-native-query name="fetchIdAndUsernameWithResultClass" result-class="CmsUser">
|
|
<query>SELECT id, username FROM cms_users WHERE username = ?</query>
|
|
</named-native-query>
|
|
|
|
<named-native-query name="fetchAllColumns" result-class="CmsUser">
|
|
<query>SELECT * FROM cms_users WHERE username = ?</query>
|
|
</named-native-query>
|
|
|
|
<named-native-query name="fetchJoinedAddress" result-set-mapping="mappingJoinedAddress">
|
|
<query>SELECT u.id, u.name, u.status, a.id AS a_id, a.country, a.zip, a.city FROM cms_users u INNER JOIN cms_addresses a ON u.id = a.user_id WHERE u.username = ?</query>
|
|
</named-native-query>
|
|
|
|
<named-native-query name="fetchJoinedPhonenumber" result-set-mapping="mappingJoinedPhonenumber">
|
|
<query>SELECT id, name, status, phonenumber AS number FROM cms_users INNER JOIN cms_phonenumbers ON id = user_id WHERE username = ?</query>
|
|
</named-native-query>
|
|
|
|
<named-native-query name="fetchUserPhonenumberCount" result-set-mapping="mappingUserPhonenumberCount">
|
|
<query>SELECT id, name, status, COUNT(phonenumber) AS numphones FROM cms_users INNER JOIN cms_phonenumbers ON id = user_id WHERE username IN (?) GROUP BY id, name, status, username ORDER BY username</query>
|
|
</named-native-query>
|
|
</named-native-queries>
|
|
|
|
<sql-result-set-mappings>
|
|
<sql-result-set-mapping name="mappingJoinedAddress">
|
|
<entity-result entity-class="__CLASS__">
|
|
<field-result name="id"/>
|
|
<field-result name="name"/>
|
|
<field-result name="status"/>
|
|
<field-result name="address.zip"/>
|
|
<field-result name="address.city"/>
|
|
<field-result name="address.country"/>
|
|
<field-result name="address.id" column="a_id"/>
|
|
</entity-result>
|
|
</sql-result-set-mapping>
|
|
|
|
<sql-result-set-mapping name="mappingJoinedPhonenumber">
|
|
<entity-result entity-class="CmsUser">
|
|
<field-result name="id"/>
|
|
<field-result name="name"/>
|
|
<field-result name="status"/>
|
|
<field-result name="phonenumbers.phonenumber" column="number"/>
|
|
</entity-result>
|
|
</sql-result-set-mapping>
|
|
|
|
<sql-result-set-mapping name="mappingUserPhonenumberCount">
|
|
<entity-result entity-class="CmsUser">
|
|
<field-result name="id"/>
|
|
<field-result name="name"/>
|
|
<field-result name="status"/>
|
|
</entity-result>
|
|
<column-result name="numphones"/>
|
|
</sql-result-set-mapping>
|
|
</sql-result-set-mappings>
|
|
|
|
<id name="id" type="integer" column="id">
|
|
<generator strategy="AUTO"/>
|
|
</id>
|
|
|
|
<field name="status" column="status" type="string" length="50" unique="true"/>
|
|
<field name="username" column="username" type="string" length="255" unique="true"/>
|
|
<field name="name" column="name" type="string" length="255"/>
|
|
|
|
<one-to-many field="phonenumbers" target-entity="CmsPhonenumber" mapped-by="user" orphan-removal="true">
|
|
<cascade>
|
|
<cascade-persist/>
|
|
<cascade-merge/>
|
|
</cascade>
|
|
</one-to-many>
|
|
|
|
<one-to-many field="articles" target-entity="CmsArticle" mapped-by="user">
|
|
<cascade>
|
|
<cascade-detach/>
|
|
</cascade>
|
|
</one-to-many>
|
|
|
|
<one-to-one field="address" target-entity="CmsAddress" inversed-by="user" orphan-removal="true">
|
|
<cascade>
|
|
<cascade-persist/>
|
|
</cascade>
|
|
<join-column name="address_id" referenced-column-name="id" />
|
|
</one-to-one>
|
|
|
|
<one-to-one field="email" target-entity="CmsEmail" inversed-by="user" orphan-removal="true">
|
|
<cascade>
|
|
<cascade-persist/>
|
|
</cascade>
|
|
<join-column referenced-column-name="id" nullable="true" />
|
|
</one-to-one>
|
|
|
|
<many-to-many field="groups" target-entity="CmsGroup">
|
|
<cascade>
|
|
<cascade-persist/>
|
|
<cascade-detach/>
|
|
<cascade-merge/>
|
|
</cascade>
|
|
<join-table name="cms_users_groups">
|
|
<join-columns>
|
|
<join-column name="user_id" referenced-column-name="id"/>
|
|
</join-columns>
|
|
<inverse-join-columns>
|
|
<join-column name="group_id" referenced-column-name="id"/>
|
|
</inverse-join-columns>
|
|
</join-table>
|
|
</many-to-many>
|
|
|
|
</entity>
|
|
|
|
</doctrine-mapping>
|