Skip to content

Instantly share code, notes, and snippets.

@webmozart
Last active August 29, 2015 14:08
Show Gist options
  • Save webmozart/b2d6f218c8c67fcc658e to your computer and use it in GitHub Desktop.
Save webmozart/b2d6f218c8c67fcc658e to your computer and use it in GitHub Desktop.
namespaces:
orm: Doctrine\ORM\Mapping
val: Symfony\Component\Validator\Constraints
acme: Acme\Validation
Doctrine\Tests\ORM\Mapping\User:
# Support "." as namespace separator
# First character of the class name can be lower-cased, which feels more natural in YAML
# i.e.: Doctrine\ORM\Mapping\Entity
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
acme.zipCode:
strict: true
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