Question

i`m need overwrite generator.yml file from bundle in vendors. Overwrite bundle is ok, override document (odm) too. How right overwrite generator.yml? I need to add two field to existing bundle. Help me pleace...

Admin generator - Cedric Lambardot

I`m have original 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: ~

Create same file in the overwriten Bundle, pointing out to him a new document and add the two fields. But all the same bundle is generated by the old 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: ~
Was it helpful?

Solution

I did it! It was necessary only in the app/config/config.yml append:

admingenerator_generator:
    base_admin_template: ...
    use_doctrine_odm: true

->    overwrite_if_exists: true

    stylesheets: []
    templates_dirs: [ ... ]
    twig:
        ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top