Skip to content

Instantly share code, notes, and snippets.

@jwage
Created April 14, 2010 15:34
Show Gist options
  • Save jwage/365955 to your computer and use it in GitHub Desktop.
Save jwage/365955 to your computer and use it in GitHub Desktop.
Doctrine\Tests\ORM\Mapping\User:
type: entity
table: cms_users
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 50
nullable: true
unique: true
email:
type: string
column: user_email
columnDefinition: CHAR(32) NOT NULL
oneToOne:
address:
targetEntity: Address
inversedBy: user
joinColumn:
name: address_id
referencedColumnName: id
onDelete: CASCADE
onUpdate: CASCADE
cascade: [ remove ]
oneToMany:
phonenumbers:
targetEntity: Phonenumber
mappedBy: user
orderBy:
number: ASC
cascade: [ persist ]
manyToMany:
groups:
targetEntity: Group
joinTable:
name: cms_users_groups
joinColumns:
user_id:
referencedColumnName: id
nullable: false
unique: false
inverseJoinColumns:
group_id:
referencedColumnName: id
columnDefinition: INT NULL
cascade:
- all
lifecycleCallbacks:
prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersistToo ]
postPersist: [ doStuffOnPostPersist ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment