-1

我需要从供应商的捆绑包中覆盖 generator.yml 文件。覆盖捆绑包是好的,也覆盖文档(odm)。如何正确覆盖generator.yml?我需要在现有包中添加两个字段。帮我认...

管理员生成器 - Cedric Lambardot

我有原始的 generator.yml:

generator: admingenerator.generator.doctrine_odm
params:
  model: Acme\ProductBundle\Document\Product
  namespace_prefix: Acme
  bundle_name: ProductBundle
  i18n_catalog: AcmeProductBundle
  object_actions:
        delete: ~
  fields:
    name:
      label: product.name

    model:
      label: model

    #...

builders:
  list:
    params:
      title: product.list
      display: [ name,  model,  ]
      actions:
        new: ~
      object_actions:
        edit: ~
        delete: ~
  filters:
    params:
      display: [ name, model, ...]
  new:
    params:
      title: product.new
      tabs:
        'data':           
          'data': [ name,  model, ... ]
        'images':  
          'images': [ ... ]
        'seo':
          'seo': [ ... ]
        'parameter.plural':
          'parameter.plural': [ ... ]
      actions:
        list: ~
        save: ~
        save-and-list: ~
  edit:
    params:
      title: "\"{{ Product.name }}\""
      tabs:
        'data':           
          'data': [ name,  model, ... ]
        'images':  
          'images': [ ... ]
        'seo':
          'seo': [ ... ]
        'parameter.plural':
          'parameter.plural': [ ... ]
        'suiteCompose':
          'suiteCompose': [ ... ]
      actions:
        list: ~
        save: ~
        save-and-list: ~
  actions:
      params:
        object_actions:
            delete: ~

在覆盖的 Bundle 中创建相同的文件,向他指出一个新文档并添加两个字段。但是所有相同的包都是由旧的 generator.yml 生成的

generator: admingenerator.generator.doctrine_odm
params:
  model: Acme\AnniProductBundle\Document\Product
  namespace_prefix: Acme
  bundle_name: ProductBundle
  i18n_catalog: AcmeProductBundle
  object_actions:
        delete: ~
  fields:
    name:
      label: product.name

    model:
      label: model

    #...

builders:
  list:
    params:
      title: product.list
      display: [ name,  model,  ]
      actions:
        new: ~
      object_actions:
        edit: ~
        delete: ~
  filters:
    params:
      display: [ name, model, ...]
  new:
    params:
      title: product.new
      tabs:
        'data':           
          'data': [ name,  model, ... ]
        'images':  
          'images': [ ... ]
        'seo':
          'seo': [ ... ]
        'parameter.plural':
          'parameter.plural': [ ... ]
      actions:
        list: ~
        save: ~
        save-and-list: ~
  edit:
    params:
      title: "\"{{ Product.name }}\""
      tabs:
        'data':           
          'data': [ name,  model, ... ]
        'images':  
          'images': [ ... ]
        'seo':
          'seo': [ ... ]
        'parameter.plural':
          'parameter.plural': [ ... ]
        'suiteCompose':
          'suiteCompose': [ ... ]
      actions:
        list: ~
        save: ~
        save-and-list: ~
  actions:
      params:
        object_actions:
            delete: ~
4

1 回答 1

0

我做的!仅在 app/config/config.yml 附加中是必需的:

admingenerator_generator:
    base_admin_template: ...
    use_doctrine_odm: true

->    overwrite_if_exists: true

    stylesheets: []
    templates_dirs: [ ... ]
    twig:
        ...
于 2013-08-16T08:16:15.750 回答