Doctrine does not export relation properly

Posted by iggnition on Stack Overflow See other posts from Stack Overflow or by iggnition
Published on 2010-04-28T08:37:38Z Indexed on 2010/04/28 8:43 UTC
Read the original article Hit count: 417

Hi,

I've got a MySQL 5.1.41 database which i'm trying to fill with doctrine, but doctrine does not insert the relations correctly. My YAML is:

Locatie:
 connection: doctrine
 tableName: locatie
  columns:
   loc_id:
    type: integer(4)
    fixed: false
    unsigned: false
    primary: true
    autoincrement: true
  org_id:
    type: integer(4)
    fixed: false
    unsigned: false
    primary: false
    notnull: false
    autoincrement: false
  naam:
    type: string(30)
    fixed: false
    unsigned: false
    primary: false
    notnull: true
    autoincrement: false
  straat:
    type: string(30)
    fixed: false
    unsigned: false
    primary: false
    notnull: true
    autoincrement: false
  huisnummer:
    type: integer(4)
    fixed: false
    unsigned: false
    primary: false
    notnull: true
    autoincrement: false
  huisnummer_achtervoegsel:
    type: string(3)
    fixed: false
    unsigned: false
    primary: false
    notnull: false
    autoincrement: false
  plaats:
    type: string(25)
    fixed: false
    unsigned: false
    primary: false
    notnull: true
    autoincrement: false
  postcode:
    type: string(6)
    fixed: false
    unsigned: false
    primary: false
    notnull: true
    autoincrement: false
  telefoon:
    type: string(12)
    fixed: false
    unsigned: false
    primary: false
    notnull: true
    autoincrement: false
  opmerking:
    type: string()
    fixed: false
    unsigned: false
    primary: false
    notnull: false
    autoincrement: false
  inloggegevens:
    type: string()
    fixed: false
    unsigned: false
    primary: false
    notnull: false
    autoincrement: false
relations:
  Organisatie:
    local: org_id
    foreign: org_id
    type: one
    onDelete: CASCADE
    onUpdate: CASCADE

Organisatie:
  connection: doctrine
  tableName: organisatie
  columns:
    org_id:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    naam:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    straat:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    huisnummer:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    huisnummer_achtervoegsel:
      type: string(3)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    plaats:
      type: string(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    postcode:
      type: string(6)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    telefoon:
      type: string(12)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    opmerking:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
  relations:
    Locatie:
      local: org_id
      foreign: org_id
      type: many

Now if a make an organisation and then create a location which has a foreignkey to organisation everything is fine. but when i try to update the org_id with phpmyadmin i get a contraint error. If i manually set the foreign key to ON_UPDATE CASCADE it does work.

Why does doctrine not set this option?

I got it to work in Propel, but i really want to use doctrine for this.

© Stack Overflow or respective owner

Related posts about doctrine

Related posts about entity-relationship