Google Groups

YML Doctrine2 onUpdate: CASCADE Missing?


Steve Davies Feb 13, 2012 7:09 AM
Posted in group: doctrine-user
I'm trying to get a Doctrine2 and Zend Framework 1.11 project off the
ground but am unable to keep onUpdate: CASCADE on my foreign keys. I'm
using Doctrine's YAML driver and generate my entities using
'orm:generate-entities --generate-annotations=1' but when I then run
'orm:schema-tool:create' the onUpdate attirbutes of the foreign keys
don't get created.

Can anyone tell me where I'm going wrong or point me in the direction
of an example? I've searched long and hard and don't seem to be able
to come up with one?

Here's an example of the YML I'm working with:

UserManagement\passwords:
  type: entity
  table: passwords_table
  fields:
    id:
      id: true
      type: integer
      generator:
        strategy: AUTO
    password:
      type: smallint
      length: 125
      nullable: false
  manyToOne:
    invAlias:
      targetEntity: UserManagement\users
      inversedBy: ownAlias
      cascade: ["all", "persist", "merge", "remove", "refresh"]
      joinColumns:
        user_id:
          referencedColumnName: id
          onDelete: CASCADE
          onUpdate: CASCADE
    cat:
      targetEntity: UserManagement\category
      inversedBy: pswd
      joinColumns:
        category_id:
          referencedColumnName: id
          onDelete: CASCADE
          onUpdate: CASCADE