1

在我的 ACL 装置中,我有资源和动作,大多数资源共享共同的动作,如 CRUD,在 Doctrine (yaml) 中有没有办法扩展另一个元素?

这是我当前的 yaml 的简介:


Resource:
  R1:
    title: Article
    system_name: ARTICLE
    Actions:
        A1:
            title: Create
            system_name: CREATE
        A2:
            title: Read
            system_name: READ
        A3:
            title: Update
            system_name: UPDATE
        A4:
            title: Delete
            system_name: DELETE

我如何使用新资源扩展 R1,例如,称为“新闻文章”,它将继承 A1 到 A4 + 包括它自己的操作?

4

1 回答 1

2

“锚和别名”+合并就是答案:

http://yaml.github.com/yaml-spec/#id2768357

(使用http://instantyaml.appspot.com/查看规范 YAML 的外观)

Resource:
  R1:
    title: Article
    system_name: ARTICLE
    Actions: &id1
        A1:
            title: Create
            system_name: CREATE
        A2:
            title: Read
            system_name: READ
  R2:
    system_name: New ARTICLE
    Actions:
       <<: *id1
       A5:
            title: Drop
            system_name: DROP
于 2009-06-02T08:04:31.340 回答