php - Generated unique key in relational doctrine -


i trying create onetomany relation between answers , questions tables in doctrine. these basic yaml schemas

answer schema

  type: entity   table: fs_answer   fields:     id:       id: true       type: integer       unsigned: false       nullable: false       generator:         strategy: identity     questionid:       type: integer       unsigned: false       nullable: false       column: question_id     body:       type: text       nullable: false   onetoone:     question:       targetentity: fsquestion       cascade: {  }       mappedby: null       inversedby: null       joincolumns:     question_id:       referencedcolumnname: id       orphanremoval: false   lifecyclecallbacks: {  } 

question schema:

  type: entity   table: fs_question   fields:     id:       id: true       type: integer       unsigned: false       nullable: false       generator:         strategy: identity     body:       type: text       nullable: false   onetomany:     answer:       targetentity: fsanswer       cascade: {  }       mappedby: question       inversedby: answers       joincolumns:     question_id:       referencedcolumnname: id       orphanremoval: false   lifecyclecallbacks: {  } 

when update schema doctrine:schema:update, generated sql code below , put unique key 'question_id' in answers table.

create table if not exists `fs_answer` (   `id` int(11) not null auto_increment,   `question_id` int(11) not null,   `body` longtext not null,   primary key (`id`),   unique key `uniq_552d082b1e27f6bf` (`question_id`) ) engine=innodb  default charset=utf8 auto_increment=1; 

how avoid unique key stuff? logically (one many) there should not unique key question id in answers table.

actually simple code below

question:

onetomany:   answer:     targetentity: fsanswer     mappedby: question     cascade: ["persist"] 

answer:

manytoone:   question:     targetentity: fsquestion     inversedby: answer 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -