Giter Club home page Giter Club logo

Comments (10)

mmenozzi avatar mmenozzi commented on June 9, 2024 1

Yes sounds good. Feel free to provide a PR if you need this fix soon. Anyway we’ll do our best to fix this issue ASAP.

from syliusakeneoplugin.

mmenozzi avatar mmenozzi commented on June 9, 2024

Yes. It's because now the plugin properly imports attributes that have been emptied on Akeneo. So if you have at least one empty attribute imported with the TranslatablePropertyValueHandler, now the plugin creates the translations for all languages to be able to set null on that property. So now it fails if you have untranslated products on Akeneo (at least for the not nullable properties).

A quick solution to this is to implement a listener on the product.pre_create/update event which removes empty translations before saving.

Another solution it could be to not create the translation in the TranslatablePropertyValueHandler if the value is null.

What do you think? We're open to suggestions.

from syliusakeneoplugin.

aleho avatar aleho commented on June 9, 2024

In my opinion I would not create a translation if it cannot be created with valid data.

In a setup where the default locale is X and there's also "optional" locales A, B, C, a missing translation leads to a failed import (even though the data is "valid" in Akeneo).

So, I'd not create the translation at all.

from syliusakeneoplugin.

mmenozzi avatar mmenozzi commented on June 9, 2024

Hi @aleho,
have a look at the #63 PR for this issue.
Let me know what do you think.

from syliusakeneoplugin.

aleho avatar aleho commented on June 9, 2024

Sorry, there was a lot going on and I couldn't get the import to run.

Apparently if productVariants on $existentProductImage is null (ImageValueHandler:104) the check hasProductVariant fails completely. It should be set in the constructor, but apparently that's never called for existing entities.

What's especially odd here: $existentProductImage instanceof Sylius\Component\Core\ModelProductImage, even though Sylius is set up and configured correctly and the entity has not been touched:

$ console debug:container --parameter=sylius.model.product_image.class
 ---------------------------------- --------------------------------- 
  Parameter                          Value                            
 ---------------------------------- --------------------------------- 
  sylius.model.product_image.class   App\Entity\Product\ProductImage  
 ---------------------------------- --------------------------------- 

So I couldn't even override the method in there to check of the collection to do a temporary check like return($this->productVariants && parent::hasProductVariant($productVariant));.

What's wrong there?

Edit: I tried with a completely empty product table. Initial import works, subsequent ones are broken.

from syliusakeneoplugin.

mmenozzi avatar mmenozzi commented on June 9, 2024

@aleho we never had this issue. Btw I don't think it's related to empty translations.

from syliusakeneoplugin.

aleho avatar aleho commented on June 9, 2024

It only happens since bbaecd1. Haven't had time to investigate, but a clean import and subsequent update fails and can be reproduced here.

I'll try to get more details as soon as possible.

from syliusakeneoplugin.

mmenozzi avatar mmenozzi commented on June 9, 2024

Ok thank you. Please, when you'll have further details open a new issue for the ImageValueHandler bug.

This one is for empty translations (so the TranlsatablePropertyValueHandler).

from syliusakeneoplugin.

aleho avatar aleho commented on June 9, 2024

You're right. I suspected the commit being the culprit for the other problem too (but should have opened a separate issue anyway).

Turns out, FriendsOfSylius/SyliusImportExportPlugin overrides the configuration in a very unexpected way.

Sorry for the noise, just thought to comment this here for the sake of completeness.

from syliusakeneoplugin.

mmenozzi avatar mmenozzi commented on June 9, 2024

Thank you for the update @aleho !

from syliusakeneoplugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.