Hi,

I don't think the error is caused by your relation because it's
conected to the sf_guard_group table.

Anyway I think you want to define a 1:1 relation between EventMember
and sfGuardUser, so you need to add "foreignType: one" to you relation
specification and the foreignAlias sfGuardUser don't look good. I
would change it to something like "Member" or just remove it and use
EventMember...

Then the relation between events and event members should be changed
too.

relations:
    sfGuardUser:  {  onDelete: CASCADE,local: member_id, foreign: id,
foreignType: one  }
    Event:    {  onDelete: CASCADE,local: event_id, foreign: id,
foreingAlias: EventMembers  }


On 4 kvě, 14:11, trankh <juliend1...@gmail.com> wrote:
> Every symfony developper has encountered this implemantation.
>
> How to define a relation between a sfGuardUser and an other object?
>
> I need a schema.yml example.
>
> Imagine an object EventMember which defines a relation between
> anobjet Event and an object sfGuardUser (which is a member in the
> application)
>
> # config/doctrine/schema.yml
> Event:
>   actAs: { Timestampable: ~ }
>   columns:
>     id:  { type: integer, primary: true }
>     name: { type: string(255), notnull: true, unique: true }
>
> EventMember:
>   columns:
>     event_id:  { type: integer, primary: true }
>     member_id: { type: integer, primary: true }
>     motivation:  { type: string(300) }
>   relations:
>     sfGuardUser:  {  onDelete: CASCADE,local: member_id, foreign: id,
> foreignAlias: sfGuardUser  }
>     Event:    {  onDelete: CASCADE,local: event_id, foreign: id,
> foreignAlias: Event  }
>
> This error is generated:
>
>   SQLSTATE[HY000]: General error: 1005 Can't create table './zulu/
> #sql-41ca_1c9.frm' (errno: 121). Failing Query: "ALTER TABLE
> sf_guard_group_permission ADD CONSTRAINT
> sf_guard_group_permission_permission_id_sf_guard_permission_id FOREIGN
> KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE
> CASCADE". Failing Query: ALTER TABLE sf_guard_group_permission ADD
> CONSTRAINT
> sf_guard_group_permission_permission_id_sf_guard_permission_id FOREIGN
> KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE
> CASCADE
>
> Thank you for your help
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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

Reply via email to