symfony2admingenerator / AvocodeFormExtensionsBundle

(old-legacy) Symfony2 form extensions for Admingenerator project (also working standalone!)
Other
48 stars 31 forks source link

could not display picture in list /show View #114

Open SultanKane opened 10 years ago

SultanKane commented 10 years ago

hi im using AdmingeneratorGeneratorBundle ,AvocodeFormExtensionsundle and VichUploaderBundle i got error when trying to display picture in admingenerator List/show using afe_collection_upload , Catchable Fatal Error: Object of class \PneumaticModelBundle\Entity\Image could not be converted to string is there additional configuration for doing that ?

can we display picture in List/show ?

sescandell commented 10 years ago

Hi @azzabiramy

Of course you can, but you probably have to customize your views or something like that and not display your Image object as it. I think something is missing in your code, could you please give us some code?

SultanKane commented 10 years ago

hi @sescandell here is the generator.yml:

generator: admingenerator.generator.doctrine params: model: Rayensoft\pneumaticmodelBundle\Entity\pneumaticModel namespace_prefix: Rayensoft concurrency_lock: ~ bundle_name: pneumaticModelBundle pk_requirement: ~ fields:

   medias:
        label: Image
        dbType:               collection
        formType:             afe_collection_upload
        addFormOptions:

            nameable:         true
            nameable_field:   name
            sortable:         false
            editable:         [name]

            type:             \Rayensoft\pneumaticmodelBundle\Form\Type\ImageType
            previewMaxWidth:  100
            previewMaxHeight: 100
            loadImageFileTypes:   /^image\/(gif|jpe?g|png)$/i
            acceptFileTypes:  /^image\/(gif|jpeg|png)$/
            previewAsCanvas:      true
            prependFiles:         true
            allow_add:        true
            allow_delete:     true
            error_bubbling:   false
            # uploadRouteName:  avocode_upload_route
            options:
                data_class:   \Rayensoft\pneumaticmodelBundle\Entity\Image
   lab:
     label: Nom du modèle 

 object_actions:
    delete: ~
 batch_actions:
    delete: ~

builders: list: params: title: List for pneumaticmodel display: [lab] actions: new: ~ object_actions: edit: ~ delete: ~ filters: params: display: [lab] new: params: title: New object for pneumaticmodel display:

        actions:
            save: ~
            list: ~
 show:
    params:
        title: "You're viewing the object \"%object%\"|{ %object%: pneumaticmodel.id }|"
        display: [lab,medias]
        actions:
            list: ~
            new: ~
 actions:
    params:
        object_actions:
            delete: ~
        batch_actions:
            delete: ~
SultanKane commented 10 years ago

the form type and the entity file are made the same as your example (i want to thank you for giving us a sample code that is really helpfull )