Skip to content
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

Collection Upload edit form problem #157

Open
ndoulgeridis opened this issue Dec 29, 2014 · 9 comments
Open

Collection Upload edit form problem #157

ndoulgeridis opened this issue Dec 29, 2014 · 9 comments
Labels

Comments

@ndoulgeridis
Copy link

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

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

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

What is the version of your Vich library please?

@ndoulgeridis
Copy link
Author

I use

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

I think latest dev-master is v0.13.0

@sescandell
Copy link
Member

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

@sescandell sescandell added the bug label Jan 5, 2015
@numerogeek
Copy link

up

@ioleo
Copy link
Member

ioleo commented Jun 11, 2015

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

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

ioleo commented Jun 13, 2015

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

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

No branches or pull requests

4 participants