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

Image product never delete ? #4294

Closed
lpxavi opened this issue Apr 5, 2016 · 4 comments
Closed

Image product never delete ? #4294

lpxavi opened this issue Apr 5, 2016 · 4 comments

Comments

@lpxavi
Copy link

lpxavi commented Apr 5, 2016

Hi,

I use Akeneo v1.4.22.

I have noticed that product's images are never delete. Neither when delete image of a product nor when we execute a mass product import with image.

It's a bug or it's good ?

Is there a way to delete all image not link at a product ?

Thank's you

@a2xchip
Copy link
Contributor

a2xchip commented Apr 6, 2016

Hello @lpxavi
This issue seems to be related with #3572

Here is the @juliensnz answer

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 ?

@a2xchip
Copy link
Contributor

a2xchip commented Apr 6, 2016

@lpxavi See this part of orm mapping

# ProductValue.orm.yml

Pim\Bundle\CatalogBundle\Model\ProductValue:
    type: entity
    table: pim_catalog_product_value
    changeTrackingPolicy: DEFERRED_EXPLICIT
    # ......
        manyToOne:
        # ........
        media:
            targetEntity: Akeneo\Component\FileStorage\Model\FileInfoInterface
            cascade:
                - remove
                - persist
                - refresh
                - detach
            joinColumns:
                media_id:
                    referencedColumnName: id
                    onDelete: 'SET NULL' # this line

@juliensnz
Copy link
Contributor

I confirm this information. It's too dangerous remove a file from the file system. You can create a command to remove unused files if needed.

I also add this command idea to our backlog (reference IM-491)

Regards,

Julien

@hostep
Copy link

hostep commented Dec 18, 2019

Hi @juliensnz

Out of curiosity, was IM-491 ever implemented in a newer version of Akeneo?

I'm having a task to cleanup images no longer associated to products on an Akeneo CE 2.3 installation and I'm wondering if this feature ever made it in this version or a newer version, because I can't seem to find it at first sight.

Thanks!

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

4 participants