Hi,

you should use in 10_user.yml:

sfGuardUser:
  dziobacz:
    username: dziobacz
    password: haslo123

and in 20_profile.yml:

sfGuardUserProfile:
  dziobacz:
    user_id: dziobacz
    name: xyz
    email: [email protected]

Marius


-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]]
Im Auftrag von dziobacz
Gesendet: Montag, 26. Oktober 2009 11:51
An: symfony users
Betreff: [symfony-users] DOCTRINE - load data to tables which has got a
relation !!


I have got table sfGuardUser and sfGuardUserProfile. Table
sfGuardUserProfile in schema.yml:
sfGuardUserProfile:
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    user_id:
      type: integer(4)
      default: ''
      notnull: true
      unique: true
    name:
      type: string(50)
      default: ''
      notnull: true
    email:
      type: string(50)
      default: ''
      notnull: true
      unique: true
  relations:
    sfGuardUser:
      class: sfGuardUser
      local: user_id
      foreign: id
      type: one
      onDelete: CASCADE
      onUpdate: CASCADE

I have got file 10_user.yml:
sfGuardUser:
  dziobacz:
    id: 1
    username: dziobacz
    password: haslo123

And file 20_profile.yml:
sfGuardUserProfile:
  dziobacz:
    user_id: 1
    name: xyz
    email: [email protected]

And when I try to load data:
php symfony doctrine:data-load

I get error:
General error: 1452 Cannot add or update a child row: a foreign key
constraint fails ('dziobaczmodule/sf_guard_user_profile', CONSTRAINT
'sf_guard_user_profile_ibfk_1' FOREIGN KEY ('user_id') REFERENCE
'sf_guard_user' ('id') ON DELETE CASCADE ON UPDATE CASCADE)

I can't add row to table sfGuardUserProfile - is it normal ??



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to