【问题标题】:Can fixtures "copy" items from other fixtures?固定装置可以从其他固定装置“复制”项目吗?
【发布时间】:2010-10-30 02:35:07
【问题描述】:

在我的 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 + 包含它自己的操作?

【问题讨论】:

    标签: php doctrine yaml acl


    【解决方案1】:

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

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-24
      • 2011-05-04
      • 1970-01-01
      • 2018-02-10
      • 2016-12-15
      相关资源
      最近更新 更多