Search code examples
assetsakeneo

How do I generate the variation file for all assets


I'm new to Akeneo, and I discovered profile configuration for assets.

So I imported my YML in order to add asset transformations, and now, cli based, I can't find a command that allows me to generate the variation file for all assets. I saw the command to do that asset by asset and channel by channel, but I need to do that for all of them.

Do you know how I can manage to do that ? I already tried pim:asset:generate-missing-variation-files but that didn't change anything


Solution

  • There is no built-in command to do that, however you could develop a very simple command to achieve this.

    You can use the pimee_product_asset.finder.asset service to call retrieveVariationsNotGenerated() in order to retrieve every variation that are not yet genreated, then finally use the pimee_product_asset.variation_file_generator to generate the variation with generate().

    Not tested code, but this would be like that:

    $finder = $this->get('pimee_product_asset.finder.asset');
    $generator = $this->get('pimee_product_asset.variation_file_generator');
    
    $variations = $finder->retrieveVariationsNotGenerated();
    foreach ($variations as $variation) {
        $generator->generate($variation);
    }