【问题标题】:Forum board example schema in YAML format - modify for Nested set?YAML 格式的论坛板示例模式 - 修改嵌套集?
【发布时间】:2010-03-15 10:42:09
【问题描述】:

我根据Doctrine Manual 的“真实世界示例”中的 YAML 架构创建了一个论坛板应用程序,它看起来类似于:

---
Forum_Category:
  columns:
    root_category_id: integer(10)
    parent_category_id: integer(10)
    name: string(50)
    description: string(99999)
  relations:
    Subcategory:
      class: Forum_Category
      local: parent_category_id
      foreign: id
    Rootcategory:
      class: Forum_Category
      local: root_category_id
      foreign: id

Forum_Board:
  columns:
    category_id: integer(10)
    name: string(100)
    description: string(5000)
  relations:
    Category:
      class: Forum_Category
      local: category_id
      foreign: id
    Threads:
      class: Forum_Thread
      local: id
      foreign: board_id

Forum_Entry:
  columns:
    author: string(50)
    topic: string(100)
    message: string(99999)
    parent_entry_id: integer(10)
    thread_id: integer(10)
    date: integer(10)
  relations:
    Parent:
      class: Forum_Entry
      local: parent_entry_id
      foreign: id
    Thread:
      class: Forum_Thread
      local: thread_id
      foreign: id

Forum_Thread:
  columns:
    board_id: integer(10)
    updated: integer(10)
    closed: integer(1)
  relations:
    Board:
      class: Forum_Board
      local: board_id
      foreign: id
    Entries:
      class: Forum_Entry
      local: id
      foreign: thread_id

如何修改此架构,以使用 NestedSet(线程和条目的树结构)?

【问题讨论】:

    标签: php sql doctrine forum yaml


    【解决方案1】:

    添加actAs参数,示例:

    Forum_Thread:
      actAs:
        NestedSet:
          hasManyRoots: true
          rootColumnName: root_id
      columns:....
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-28
      相关资源
      最近更新 更多