83 lines
3.2 KiB
XML
83 lines
3.2 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\ORM\Mapping\User" table="cms_users">
|
|
<options>
|
|
<option name="foo">bar</option>
|
|
<option name="baz">
|
|
<option name="key">val</option>
|
|
</option>
|
|
</options>
|
|
|
|
<indexes>
|
|
<index name="name_idx" columns="name"/>
|
|
<index columns="user_email"/>
|
|
</indexes>
|
|
|
|
<unique-constraints>
|
|
<unique-constraint columns="name,user_email" name="search_idx" />
|
|
</unique-constraints>
|
|
|
|
<lifecycle-callbacks>
|
|
<lifecycle-callback type="prePersist" method="doStuffOnPrePersist"/>
|
|
<lifecycle-callback type="prePersist" method="doOtherStuffOnPrePersistToo"/>
|
|
<lifecycle-callback type="postPersist" method="doStuffOnPostPersist"/>
|
|
</lifecycle-callbacks>
|
|
|
|
<named-queries>
|
|
<named-query name="all" query="SELECT u FROM __CLASS__ u"/>
|
|
</named-queries>
|
|
|
|
<id name="id" type="integer" column="id">
|
|
<generator strategy="AUTO"/>
|
|
<sequence-generator sequence-name="tablename_seq" allocation-size="100" initial-value="1" />
|
|
</id>
|
|
|
|
<field name="name" column="name" type="string" length="50" nullable="true" unique="true">
|
|
<options>
|
|
<option name="foo">bar</option>
|
|
<option name="baz">
|
|
<option name="key">val</option>
|
|
</option>
|
|
</options>
|
|
</field>
|
|
<field name="email" column="user_email" type="string" column-definition="CHAR(32) NOT NULL" />
|
|
|
|
<field name="version" type="integer" version="true" />
|
|
|
|
<one-to-one field="address" target-entity="Address" inversed-by="user">
|
|
<cascade><cascade-remove /></cascade>
|
|
<join-column name="address_id" referenced-column-name="id" on-delete="CASCADE" on-update="CASCADE"/>
|
|
</one-to-one>
|
|
|
|
<one-to-many field="phonenumbers" target-entity="Phonenumber" mapped-by="user" index-by="number" orphan-removal="true">
|
|
<cascade>
|
|
<cascade-persist/>
|
|
</cascade>
|
|
<order-by>
|
|
<order-by-field name="number" direction="ASC" />
|
|
</order-by>
|
|
</one-to-many>
|
|
|
|
<many-to-many field="groups" target-entity="Group">
|
|
<cascade>
|
|
<cascade-all/>
|
|
</cascade>
|
|
<join-table name="cms_users_groups">
|
|
<join-columns>
|
|
<join-column name="user_id" referenced-column-name="id" nullable="false" unique="false" />
|
|
</join-columns>
|
|
<inverse-join-columns>
|
|
<join-column name="group_id" referenced-column-name="id" column-definition="INT NULL" />
|
|
</inverse-join-columns>
|
|
</join-table>
|
|
</many-to-many>
|
|
|
|
</entity>
|
|
|
|
</doctrine-mapping>
|