Created
October 24, 2014 22:36
-
-
Save webmozart/220946b7ff8a1b74e554 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Doctrine.Tests.ORM.Mapping.User.dcm.xml | |
<?xml version="1.0" encoding="UTF-8"?> | |
<map:class-mapping xmlns="http://doctrine-project.org/schemas/orm" | |
xmlns:map="http://doctrine-project.org/schemas/annotations/class-mapping"> | |
<map:class name="Doctrine\Tests\ORM\Mapping\User"> | |
<entity table="cms_users" /> | |
<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> | |
<map:property name="id"> | |
<id type="integer" column="id"> | |
<generator strategy="AUTO"/> | |
<sequence-generator sequence-name="tablename_seq" allocation-size="100" initial-value="1" /> | |
</id> | |
</map:property> | |
<map:property name="name"> | |
<column name="name" type="string" length="50" nullable="true" unique="true" /> | |
</map:property> | |
<map:property name="email"> | |
<column name="user_email" type="string" column-definition="CHAR(32) NOT NULL" /> | |
</map:property> | |
<map:property name="address"> | |
<one-to-one 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> | |
</map:property> | |
<map:property name="address"> | |
<one-to-many target-entity="Phonenumber" mapped-by="user"> | |
<cascade> | |
<cascade-persist/> | |
</cascade> | |
<order-by> | |
<order-by-field name="number" direction="ASC" /> | |
</order-by> | |
</one-to-many> | |
</map:property> | |
<map:property name="groups"> | |
<many-to-many 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> | |
</map:property> | |
<map:method name="doStuffOnPrePersist"> | |
<lifecycle-callback type="prePersist"/> | |
</map:method> | |
<map:method name="doOtherStuffOnPrePersistToo"> | |
<lifecycle-callback type="prePersist"/> | |
</map:method> | |
<map:method name="doStuffOnPostPersist"> | |
<lifecycle-callback type="postPersist"/> | |
</map:method> | |
</map:class> | |
</map:class-mapping> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment