If you add a foreign alias to your relation then it's even easier...

>   relations:
>     sfGuardUser:
>       class: sfGuardUser
>       local: user_id
>       foreign: id
>       type: one
>       onDelete: CASCADE
>       onUpdate: CASCADE
         foreignAlias: Profile


> sfGuardUser:
>   dziobacz:
>     id: 1
>     username: dziobacz
>     password: haslo12
       Profile:
         name: Barney Flintstone


On Mon, 26 Oct 2009 11:51:02 +0100, dziobacz <[email protected]>  
wrote:

>
> 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 ??
> >


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--~--~---------~--~----~------------~-------~--~----~
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