There is no way to get images of a product variant without loading all the images of the parent product.
An association should be added between productVariant and productImage, so I can fetch images from product variant entity.
Also, productVariant API should be able to return productVariant's images.
It will introduce a BC break, but I would rather consider this as a bug fix than have it not fixed. @lchrusciel came into the same issue this week. @Sylius/core-team any thoughts on this one?
I think it is not a huge bc break, but valid and common use case, so I am 👍 to do it.
@pjedrzejewski , I already implemented this issue for a private project.
I will create a pull request for this.
@pamil @pjedrzejewski
After analyzing the current design of images, I found that we are not good.
Product and Taxon model both have a one-to-many uni-direction link to image.
Product variant don't share the same mapping, it have many-to-many multi-direction link to image.
Therefor, Product variant can not implement the interface ImageAwareInterface, which make development heavy (Found my self obliged to create new interface ProductImageAwareInterface and to change ImagesUploaderListner )
I think the best solution, Is to keep it simple, and to delete the link from image to product variant (ProductImage model), so we end up with a coherent design. Only subject can get it's images. Images doesn't know about products..
Most helpful comment
@pjedrzejewski , I already implemented this issue for a private project.
I will create a pull request for this.