symfony2admingenerator / AvocodeFormExtensionsBundle

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

Collection Upload edit form problem #157

Open ndoulgeridis opened 9 years ago

ndoulgeridis commented 9 years ago

Hello,

I have found an issue:

On file: vendor/avocode/form-extensions-bundle/Avocode/FormExtensionsBundle/Twig/Extension/ImageAssetsExtension.php

there is in line 64:

$params[1] = $this->container->get('vich_uploader.property_mapping_factory')->fromField($object, $field)->getMappingName();

This change the right param 1 (which in my side is file) to the vich_upload mapping name so change it to gallery_image.

This has as a result to get Doctrine mapping error as gallery_image is not a field of course but vich_upload mapping name.

Am I right?

sescandell commented 9 years ago

Hi @crash21

This has been introduce because of some changes to the Vich assets API. Before this changement, Vich was expecting a file object (or a feld, I don't remember). But since some new versions, Vich is waiting for the mapping name. But this is just for the Assets twig function. It should not change anything in your persistence layer (Doctrine).

Do you have a use case of error?

ndoulgeridis commented 9 years ago

It's happening when vich mapping name is different from file field name Then in this line I wrote above changes the field name with vich mapping name and then throws Doctrine error as the mapping name cant be mapped to the Entity because it doens't exists of course.

In example above $param 1 has the value "file" After line 64 have the value "gallery_image" and gallery_image is not a field of the Entity but just vich mapping name. Then Doctrine throws exception because tries to map gallery_image to Entity.

In my case, commenting line 64 solves the error but dunno how this will affect other use cases.

sescandell commented 9 years ago

What is the version of your Vich library please?

ndoulgeridis commented 9 years ago

I use

"vich/uploader-bundle": "dev-master"

I think latest dev-master is v0.13.0

sescandell commented 9 years ago

OK... I have no working project based on this version of Avocode Bundle. I'll test what you say updating the repository https://github.com/sescandell/CollectionUploadSample

numerogeek commented 9 years ago

up

ioleo commented 9 years ago

You should try locking on v0.13.0. If I remember correct they introduced some changes, the new repo (FormExtensionBundle) is OK with v0.14.0+ while the legacy repo (AvocodeFormExtensionsBundle) is compatible with v0.13

ndoulgeridis commented 9 years ago

Hello, @loostro where is the new repo you are talking about? (FormExtensionBundle) The only I find with this name is a repo last updated 2 years ago.

ioleo commented 9 years ago

@crash21 it's on our github account symfony2admingenerator/FormExtensionsBundle