Skip to content

Instantly share code, notes, and snippets.

@webmozart
Last active August 29, 2015 14:08
Show Gist options
  • Save webmozart/ec43cc030be608c2091f to your computer and use it in GitHub Desktop.
Save webmozart/ec43cc030be608c2091f to your computer and use it in GitHub Desktop.
namespaces:
orm: Doctrine\ORM\Mapping
val: Symfony\Component\Validator\Constraints
Doctrine\Tests\ORM\Mapping\User:
annotations:
- !orm.entity
repositoryClass: Doctrine\Tests\ORM\Mapping\UserRepository
table: cms_users
readOnly: true
- !orm.indexes
name_index:
columns: [ name ]
properties:
id:
- !orm.id
type: integer
generator:
strategy: auto
- !val.notNull ~
- !val.type integer
name:
- !orm.column
type: string
length: 50
email:
- !orm.column
type: string
length: 32
name: user_email
unique: true
options:
fixed: true
comment: User's email address
loginCount:
- !orm.column
type: integer
name: login_count
nullable: false
options:
unsigned: true
default: 0
address:
- !orm.oneToOne
targetEntity: Address
joinColumn:
name: address_id
referencedColumnName: id
onDelete: CASCADE
phonenumbers:
- !orm.oneToMany
targetEntity: Phonenumber
mappedBy: user
cascade: ["persist", "merge"]
groups:
- !orm.manyToMany
targetEntity: Group
joinTable:
name: cms_users_groups
joinColumns:
user_id:
referencedColumnName: id
inverseJoinColumns:
group_id:
referencedColumnName: id
methods:
doStuffOnPrePersist:
- !orm.lifecycleCallback prePersist
doOtherStuffOnPrePersistToo:
- !orm.lifecycleCallback prePersist
doStuffOnPostPersist:
- !orm.lifecycleCallback postPersist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment