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 at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to