symfony2admingenerator / GeneratorBundle

Admingenerator for Symfony. Parse YAML files to build customized backend.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to work with s2a_collection_table and embed_types with 2 single upload

nicoip opened this issue · comments

How to work with s2a_collection_table and embed_types with 2 single upload

I want to integrate collection's Form B into a Form A.

The Form B has two single upload, but I have a error :

An exception has been thrown during the rendering of a template 
("Impossible to determine the class name. Either specify it explicitly or give an object") in 
AdmingeneratorFormExtensionsBundle:Form/SingleUpload:controls.html.twig at line 12. 

If I remove the single upload, it works...
Alone the Form B works whith the single upload...

Have you an idea ?

Thank you

FORM A

generator: admingenerator.generator.doctrine
params:
    model: Ip\ItemBundle\Entity\Item
    namespace_prefix: Ip
    concurrency_lock: ~
    bundle_name: ItemBundle
    embed_types:
       # short syntax
       - "CategoryAdmin-generator.yml"
       - "ImageAdmin-generator.yml"
       - "PageAdmin-generator.yml"
    pk_requirement: ~
    fields:
      pages:
        label:            Pages (50 maximum)
        dbType:           collection
        formType:         s2a_collection_table
        addFormOptions: 
          # use generated embed type
          sortable: true
          max_length:     4
          sortable_field: position
          type:           \Ip\ItemBundle\Form\Type\PageAdmin\EditType
          allow_add:      true
          allow_delete:   true
          by_reference:   true
          options:
            label:          Page
            data_class:     Ip\ItemBundle\Entity\Page  

FORM B

generator: admingenerator.generator.doctrine
params:
    model: Ip\ItemBundle\Entity\Page
    namespace_prefix: Ip
    concurrency_lock: ~
    bundle_name: ItemBundle
    pk_requirement: \d+
    fields:      
      numeroPage:
        label : Page number
      imageFile:
        label:            File
        formType:         s2a_single_upload
        dbType:           string
        addFormOptions:
           deleteable:     image
           data_class:     Symfony\Component\HttpFoundation\File\File 
           previewImages: true
           previewAsCanvas: true
           previewFilter: thumb_admin_list
      fichierFile:
        label:            File
        formType:         s2a_single_upload
        dbType:           string
        addFormOptions:
           deleteable:     image
           data_class:     Symfony\Component\HttpFoundation\File\File 
           previewImages: true
           previewAsCanvas: true
           previewFilter: thumb_admin_list  

@nicoip Did you solve this problem?

Hello,

yes :)

commented

Hi @nicoip
Could you please share your solution? I'm having the same problem now