Skip to content

could not display picture in list /show View #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
SultanKane opened this issue Feb 20, 2014 · 3 comments
Open

could not display picture in list /show View #114

SultanKane opened this issue Feb 20, 2014 · 3 comments

Comments

@SultanKane
Copy link

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
Copy link
Member

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
Copy link
Author

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:
- lab
- medias
actions:
save: ~
list: ~
edit:
params:
title: "You're editing the object "%object%"|{ %object%: pneumaticmodel.id }|"
display: [lab,medias]

        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
Copy link
Author

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 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants