BlackbitDigitalCommerce / pimcore-data-director

Import Bundle for Pimcore
16 stars 3 forks source link

BUG: implode cannot return imageGallery items pathes #50

Closed kaurov closed 1 year ago

kaurov commented 1 year ago

I created dataDirector export dataport with raw field: imageGallery:Items:implode:Thumbnail#somename:Path It returns nothing '';

Athoug there is data in the gallery: if I change it to imageGallery:Items then I get ["/tmp/photo1.jpeg", "/tmp/photo2.jpeg"]

How can I get list of urls to asset images or/and their thumbnails?

BlackbitDevs commented 1 year ago

Please try: imageGallery:each:(Thumbnail#sommer_category:Path):implode

(as ImageGallery implements PHP's Iterator interface you can skip the :items - but it would also not harm if you keep it)

If this does not work (currently am not sure about the parsing of the suffix aggregation), try imageGallery:each:(Thumbnail#sommer_category:Path) and apply implode() in attribute mapping.

Your current approach fetches the items (imageGallery:Items will return an array of HotspotImage objects - it only looks as if this would return an array of strings because the HotspotImage implements the __toString() method which returns the asset's path, see https://github.com/pimcore/pimcore/blob/6b2cd411b30e86d7f69dba1a9e7a7398b93c8c2e/models/DataObject/Data/Hotspotimage.php#L215-L222) and then implodes them to a string - this does not work.

kaurov commented 1 year ago

Thank you very much!