Skip to content

Instantly share code, notes, and snippets.

@woutsanders
Forked from mnapoli/reference.yml
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save woutsanders/2f43a08fcd10061dbda0 to your computer and use it in GitHub Desktop.

Select an option

Save woutsanders/2f43a08fcd10061dbda0 to your computer and use it in GitHub Desktop.

Revisions

  1. woutsanders renamed this gist May 11, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @mnapoli mnapoli revised this gist Feb 12, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions reference.yml
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    # Inspired from http://blog.hio.fr/2011/09/17/doctrine2-yaml-mapping-example.html

    myEntity:
    MyEntity:
    type: entity
    repositoryClass: myRepositoryClass
    repositoryClass: MyRepositoryClass
    table: my_entity
    namedQueries:
    all: SELECT u FROM __CLASS__ u
    all: "SELECT u FROM __CLASS__ u"

    # Class-Table-Inheritance
    inheritanceType: joined
  3. @mnapoli mnapoli revised this gist Feb 15, 2013. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions reference.yml
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,15 @@ myEntity:
    namedQueries:
    all: SELECT u FROM __CLASS__ u

    # Class-Table-Inheritance
    inheritanceType: joined
    discriminatorColumn:
    name: type
    type: string
    discriminatorMap:
    class1: MyClass1
    class2: MyClass2

    id:
    id:
    type: integer
  4. @mnapoli mnapoli revised this gist Dec 21, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions reference.yml
    Original file line number Diff line number Diff line change
    @@ -65,6 +65,7 @@ myEntity:
    manyToMany:
    groups:
    targetEntity: Group
    inversedBy: users
    joinTable:
    name: users_groups
    joinColumns:
  5. @mnapoli mnapoli revised this gist Nov 28, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions reference.yml
    Original file line number Diff line number Diff line change
    @@ -95,6 +95,7 @@ myEntity:
    referencedColumnName: id
    nullable: false

    # Referencing an entity with a multiple columns primary key
    manyToOne:
    location:
    targetEntity: Location
  6. @mnapoli mnapoli revised this gist Nov 28, 2012. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions reference.yml
    Original file line number Diff line number Diff line change
    @@ -95,6 +95,17 @@ myEntity:
    referencedColumnName: id
    nullable: false

    manyToOne:
    location:
    targetEntity: Location
    joinColumns:
    - name: location_latitude
    referencedColumnName: latitude
    nullable: false
    - name: location_longitude
    referencedColumnName: longitude
    nullable: false

    lifecycleCallbacks:
    prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersistToo ]
    postPersist: [ doStuffOnPostPersist ]
  7. @mnapoli mnapoli revised this gist Oct 26, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion reference.yml
    Original file line number Diff line number Diff line change
    @@ -104,7 +104,7 @@ myEntity:

    uniqueConstraints:
    search_idx:
    columns: name,user_email
    columns: [name, user_email]

    indexes:
    name_idx:
  8. @mnapoli mnapoli revised this gist Oct 11, 2012. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions reference.yml
    Original file line number Diff line number Diff line change
    @@ -48,6 +48,19 @@ myEntity:
    number: ASC
    cascade: [ persist ]

    # ManyToMany unidirectionnal
    manyToMany:
    groups:
    targetEntity: Group
    joinTable:
    name: users_groups
    joinColumns:
    user_id:
    referencedColumnName: id
    inverseJoinColumns:
    group_id:
    referencedColumnName: id

    # ManyToMany bidirectionnal
    manyToMany:
    groups:
  9. @mnapoli mnapoli revised this gist Oct 11, 2012. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions reference.yml
    Original file line number Diff line number Diff line change
    @@ -48,6 +48,7 @@ myEntity:
    number: ASC
    cascade: [ persist ]

    # ManyToMany bidirectionnal
    manyToMany:
    groups:
    targetEntity: Group
    @@ -64,6 +65,13 @@ myEntity:
    columnDefinition: INT NULL
    cascade:
    - all
    # Inverse side
    Group:
    type: entity
    manyToMany:
    users:
    targetEntity: User
    mappedBy: groups

    manyToOne:
    securityLevel:
  10. @mnapoli mnapoli revised this gist Oct 5, 2012. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions reference.yml
    Original file line number Diff line number Diff line change
    @@ -77,6 +77,9 @@ myEntity:
    lifecycleCallbacks:
    prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersistToo ]
    postPersist: [ doStuffOnPostPersist ]
    preUpdate: [ preUpdate ]
    preRemove: [ preDelete ]
    postLoad: [ postLoad ]

    uniqueConstraints:
    search_idx:
  11. @mnapoli mnapoli renamed this gist Oct 5, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  12. @mnapoli mnapoli renamed this gist Oct 5, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  13. @mnapoli mnapoli renamed this gist Oct 5, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  14. @mnapoli mnapoli revised this gist Oct 5, 2012. 2 changed files with 89 additions and 39 deletions.
    39 changes: 0 additions & 39 deletions Techno_Model_Family_Dimension.yml
    Original file line number Diff line number Diff line change
    @@ -1,39 +0,0 @@
    Techno_Model_Family_Dimension:
    type: entity
    repositoryClass: Core_Model_Repository
    table: techno_family_dimension

    id:
    _id:
    column: id
    type: integer
    generator:
    strategy: AUTO

    fields:
    _orientation:
    column: orientation
    type: integer
    _query:
    column: query
    type: string
    nullable: true

    manyToOne:
    _family:
    targetEntity: Techno_Model_Family
    inversedBy: _dimensions
    joinColumn:
    name: idFamily
    referencedColumnName: id
    nullable: false
    _meaning:
    targetEntity: Techno_Model_Meaning
    joinColumn:
    name: idMeaning
    referencedColumnName: id
    nullable: false

    uniqueConstraints:
    family_meaning:
    columns: [idFamily, idMeaning]
    89 changes: 89 additions & 0 deletions yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,89 @@
    # Inspired from http://blog.hio.fr/2011/09/17/doctrine2-yaml-mapping-example.html

    myEntity:
    type: entity
    repositoryClass: myRepositoryClass
    table: my_entity
    namedQueries:
    all: SELECT u FROM __CLASS__ u

    id:
    id:
    type: integer
    generator:
    strategy: AUTO
    sequenceGenerator:
    sequenceName: tablename_seq
    allocationSize: 100
    initialValue: 1

    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
    orphanRemoval: true
    mappedBy: user
    orderBy:
    number: ASC
    cascade: [ persist ]

    manyToMany:
    groups:
    targetEntity: Group
    joinTable:
    name: users_groups
    joinColumns:
    user_id:
    referencedColumnName: id
    nullable: false
    unique: false
    inverseJoinColumns:
    group_id:
    referencedColumnName: id
    columnDefinition: INT NULL
    cascade:
    - all

    manyToOne:
    securityLevel:
    targetEntity: SecurityLevel
    inversedBy: users
    joinColumn:
    name: securitylevel_id
    referencedColumnName: id
    nullable: false

    lifecycleCallbacks:
    prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersistToo ]
    postPersist: [ doStuffOnPostPersist ]

    uniqueConstraints:
    search_idx:
    columns: name,user_email

    indexes:
    name_idx:
    columns: name
    0:
    columns: user_email
  15. @mnapoli mnapoli created this gist Oct 5, 2012.
    39 changes: 39 additions & 0 deletions Techno_Model_Family_Dimension.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    Techno_Model_Family_Dimension:
    type: entity
    repositoryClass: Core_Model_Repository
    table: techno_family_dimension

    id:
    _id:
    column: id
    type: integer
    generator:
    strategy: AUTO

    fields:
    _orientation:
    column: orientation
    type: integer
    _query:
    column: query
    type: string
    nullable: true

    manyToOne:
    _family:
    targetEntity: Techno_Model_Family
    inversedBy: _dimensions
    joinColumn:
    name: idFamily
    referencedColumnName: id
    nullable: false
    _meaning:
    targetEntity: Techno_Model_Meaning
    joinColumn:
    name: idMeaning
    referencedColumnName: id
    nullable: false

    uniqueConstraints:
    family_meaning:
    columns: [idFamily, idMeaning]