akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
949 stars 512 forks source link

where i can disable removing media file after removing field? #3572

Closed userz58 closed 8 years ago

userz58 commented 8 years ago

i would like use HASH parameter to upload and save only unique files Akeneo\Component\FileStorage\Model\FileInfo Akeneo\Component\FileStorage\File\FileStorer

i have problem: when i click on media field on trash icon - file will saved in DB.

when i will add to product additional field "PDF description" (and upload file). if i will remove additional field - file will be deleted from DB.

where i can disable removing file when field removing?

userz58 commented 8 years ago

Pim\Bundle\CatalogBundle\Model\ProductValue: type: entity table: pim_catalog_product_value changeTrackingPolicy: DEFERRED_EXPLICIT indexes: value_idx: columns:

juliensnz commented 8 years ago

Hello @userz58,

What you try to achieve is already the normal behaviour on Akeneo PIM: When a media is removed from a product field, we keep it in the media table and keep it on the file system. We only break the relation between the product value and the media in database.

Did I miss something ?

Regards,

Julien

userz58 commented 8 years ago

when you delete additional field - file will be deleted too.

juliensnz commented 8 years ago

Which version of the PIM are you using ?

userz58 commented 8 years ago

1.4.8

juliensnz commented 8 years ago

I just checked on 1.4.12:

I go to a product with a media attached to it. I remove it and save the product.

The media is still on the mysql table and on the file system.

Could you update to try it ?

userz58 commented 8 years ago

1 you open saved product. 2 add new media attribute (field) 3 upload image or pdf

4 save product

5 remove attribute FIELD (click on cross icon) 6 save file will be deleted from DB

userz58 commented 8 years ago

scr

willy-ahva commented 8 years ago

Hi userz58 !

I reproduced a part of the behaviour you described in the 1.5.1. When I remove the custom media attribute from the product the file is not removed from the file storage but it is removed from the database.

I added a ticket for this. Thanks for your feedback :)

willy-ahva commented 8 years ago

I labelized this issue to Bug. You're very welcome to contribute and fix this bug, if you need help or if you have question don't hesitate to ask :)

Regards, Willy

damien-carcel commented 8 years ago

Hello.

This bug has just been fixed on our 1.5 branch. It will be out with our next 1.5 patch coming this week.

Regards, Damien