Symfony 1.4,Doctrine 1.2:编辑对象后,其他相关对象被删除了吗?

时间:2011-09-13 08:39:58

标签: mysql symfony1 doctrine symfony-1.4 doctrine-1.2

在我的应用中,显示器有许多基准测试(1到多个) 在监视器编辑界面中,当我保存修改时,每个具有monitor_id的基准测试我编辑的那个都被删除了!

Monitor:
  tableName: monitor
  actAs:
    Timestampable: ~
  columns:
    id : {type: integer(4), primary: true, autoincrement: true}
    label: {type: string(45)}
    url: {type: string(80)}
    frequency: {type: integer}
    timeout: {type: integer}
    method: {type: enum, values: [GET, POST, HEAD, PUT, DELETE]}
    parameters: {type: string(255)}
    active : { type: boolean, notnull: true, default: 1 }
  relations:
    GroupsByAlert:
      class: sfGuardGroup
      local: monitor_id
      foreign: sf_guard_group_id
      refClass: Alert
      foreignAlias: Groups
    Accidents:
      class: Accident
      local: id
      foreign: monitor_id

Benchmark:
  #detect_relations: true
  tableName: benchmark
  actAs:
    Timestampable: ~
  columns:
    #id: {type: integer(4), primary: true,autoincrement: true}
    monitor_id: { type: integer(4)}
    server_id: { type: integer(4)}
    connexionTime: {type: string(45)}
    executionTime: {type: string(45)}
    responseTime: {type: string(45)}
    responseCode: {type: string(45)}
    responseMessage: {type: string(45)}
    responseBody: {type: blob}
  relations:
    Monitor:
      class: Monitor
      local: monitor_id
      foreign: id
    Server:
      class: Server
      local: server_id
      foreign: id

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我找到答案了, 实际上它是我在generator.yml中省略的一个字段而忘了取消设置,hense Doctrine不知道该做什么,而是通过删除每个相关对象并重新创建另一个来开始!