Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony1 SQL错误外键约束_Symfony1 - Fatal编程技术网

Symfony1 SQL错误外键约束

Symfony1 SQL错误外键约束,symfony1,Symfony1,我已经挣扎了四天,sql外键约束失败了,我真的不知道为什么。我已经读了所有我能读到的关于那个主题的书,看起来一切都很好 这是我的schema.yml Soiree: actAs: { Timestampable: ~ } columns: titre: { type: string(255), notnull: true } description: { type: blob(), notnull: true } adresse: { type: string

我已经挣扎了四天,sql外键约束失败了,我真的不知道为什么。我已经读了所有我能读到的关于那个主题的书,看起来一切都很好

这是我的schema.yml

Soiree:
  actAs: { Timestampable: ~ }
  columns:
  titre:        { type: string(255), notnull: true }
  description:  { type: blob(), notnull: true }
  adresse: { type: string(255), notnull: true, unique: true }
  code_postal: {type: integer, notnull: true }
  ville: {type: string(255), notnull:true}
  date: {type: timestamp, notnull: true }
  type_id: {type: integer, notnull: true }
  flyer: {type: string(255), notnull:true }
  is_visible: { type: boolean, notnull:true, default:0 }
  user_id: {type:integer, notnull: true}
relations:
  sfGuardUser: {onDelete: CASCADE, local: user_id, foreign: id, foreignAlias: Users} 
  Type: {onDelete: CASCADE, local: type_id, foreign: id, alias: Types, class: Type, refClass: Soiree}  

Type:
  columns:
    titre: {type: string(255), notnull: true}

Invitation:
  actAs: { Timestampable: ~ }
  columns:
    titre:        { type: string(255), notnull: true }
    description:  { type: blob(), notnull: true }
    image:      { type: string(255), notnull: true }
    is_sent: {type: boolean, notnull:true, default:0}
    adresse:         { type: string(255) }
    code_postal:          { type: string(255) }
    code_QR: {type: string(255), notnull: true }
    invites_id: {type:integer }
    user_id: {type:integer, notnull: true}
    groupe_invites_id : {type:integer, notnull: true }
    soiree_id: {type:integer, notnull:true}
  relations:
    Invites: { onDelete: CASCADE, local: invites_id, foreign: id, alias: invite, class: Invites, refClass: Invitation } 
    Groupe_invites: { onDelete: CASCADE, local: groupe_invites_id, foreign: id, alias: invit_groupes, class: Groupe_invites, refClass: Invitation } 
    sfGuardUser: {onDelete: CASCADE, local: user_id, foreign: id, foreignAlias: Users} 
    Soiree: { onDelete: CASCADE, local: soiree_id, foreign: id, alias :Soirees, class: Soiree, refClass: Invitation } 



Groupe_invites:
  actAs: { Timestampable: ~ }
  columns:
    titre:       { type: string(255), notnull: true }
    description:     { type: string(255), notnull: true, unique: true }
    invites_id:     { type: integer, notnull: true }
    soiree_id: { type: integer }
    user_id: {type:integer, notnull: true}
  relations:
    Invites:
      onDelete: CASCADE
      local: invites_id
      foreign: id
      alias: invites
      class: Invites
      refClass: Groupe_invites
    sfGuardUser: {onDelete: CASCADE, local: user_id, foreign: id, foreignAlias: Users} 
    Soiree: { onDelete: CASCADE, local: soiree_id, foreign: id, alias: Soiree, class: Soiree, refClass: Groupe_invites } 

Invites:
  columns:
    nom:  { type: string(255), notnull: true }
    prenom: { type: string(255), notnull: true }
    age: {type: integer, notnull : true }
    email: {type: string(255), notnull: true, unique: true }
    adresse: {type: blob(), notnull: true }
    telephone: {type: integer(255), notnull: true }
    soiree_id: {type: integer, notnull: true }
    user_id: {type:integer, notnull: true}
  relations:
    sfGuardUser: {onDelete: CASCADE, local: user_id, foreign: id, foreignAlias: Users} 
    Soiree: { onDelete: CASCADE, local: soiree_id, foreign: id, alias: Soiree_invite, class: Soiree, refClass: Invites } 

Organisateur:
   actAs: {Timestampable: ~ }
   columns:
    nom: {type: string(255), notnull: true }
    prenom: {type: string(255), notnull: true }
    age: {type: integer, notnull: true }
    description: {type: blob(), notnull: true }
    photo: {type: string(255), notnull: true }
    user_id: {type:integer, notnull: true}
  relations:
    sfGuardUser: {onDelete: CASCADE, local: user_id, foreign: id, foreignAlias: Users} 


Image:
columns:
    titre: {type: string(255), notnull: true }
    description: {type: string(255), notnull: true }
    lien: {type: string(255)}
    album_id: {type: integer}
    user_id: {type: integer}
relations:
    Album: {onDelete: CASCADE, local: album_id, foreign: id, alias: Albums, class:Album, refClass:Image}
    sfGuardUser: {onDelete: CASCADE, local: user_id, foreign: id} 


Album:
columns:
    titre: {type: string(255), notnull: true }
    description: {type: blob(), notnull: true }
    user_id: {type:integer, notnull: true}
relations:
    sfGuardUser: {onDelete: CASCADE, local: user_id, foreign: id} 
我有一个类型错误:

SQLSTATE[23000]:完整性约束冲突:1452无法添加或更新子行:外键约束失败(
soiree
invitation
,约束
invitation\u ibfk\u 1
外键(
invitations\u id
)引用
invitation
id
)删除级联)


我真的需要你的帮助,谢谢

我通常将id列添加到我的表中。在合理的情况下,将此应用于表格:


id:{type:integer,primary:true,autoincrement:true}

Hi首先感谢您抽出时间阅读并回答我的帖子。不幸的是,我做了您告诉我要做的更改,但没有任何更改,我仍然会得到相同的错误…请确保任何具有foreign:id引用的表都在该表中有一个id。例如,在Groupe_invests表上:Soiree:{onDelete:CASCADE,local:Soiree_id,foreign:id,alias:Soiree,class:Soiree,refClass:Groupe_invests}确保Soriee表有一个id,因为您试图通过foreign:id引用它。在尝试上载装置时是否会出现此错误消息?