marketo/silverstripe-script-genie

此包已被弃用且不再维护。没有建议的替代包。

一个SilverStripe模块,可以从特定的模型按需或在其后(Write,Publish)生成静态JSON数据文件。

安装: 116

依赖: 0

建议者: 0

安全性: 0

星级: 3

关注者: 15

分支: 1

开放问题: 0

类型:silverstripe-module

1.2.0 2017-04-06 20:39 UTC

This package is auto-updated.

Last update: 2024-03-15 17:17:42 UTC


README

配置

ObjectType:
  regenerate_scripts: true:
  extensions:
    - GenieExtension

Injector:
  GenieScriptService:
    properties:
      typeConfiguration:
        MyClass:
          target_filename: # just use 'default' if no other needed
            generator: AClassName # Implementing getList
            filter: 
              "arrayKey:GreaterThan": "filter value"
              "CalculatedField": %strtotime|-2 weeks|Y-m-d H:i:s% 
              "OtherProp": "with things"
            order: FieldName DESC, Other ASC
            limit: 10
            template: TemplateName
            fields: ID,LastEdited,Title [optional, otherwise all fields returned]
            rootObject: TopLevelJsObjectName [optional, defaults to Window]

对于上述的CalculatedField,系统将基于提供的参数计算一个适当的值,在这种情况下,它将对'-2 weeks'执行一个strototime操作,然后将其转换为提供的格式的日期。

如果您想完全手动生成列表,创建一个实现了返回SS_List(例如DataListArrayList)的getList方法的类。