CodeExplorer assignProductMedia example
$data =
$query->
execute()->
fetchAll(PDO::FETCH_ASSOC
);
$result =
[];
foreach ($data as $row) { $productId =
(int) $row['__image_articleID'
];
$imageId =
(int) $row['__image_id'
];
$result[$productId][$imageId] =
$this->hydrator->
hydrateProductImage($row);
} return $this->
assignProductMedia($result,
$products);
} /**
* {@inheritdoc}
*/
public function getCovers($products, ShopContextInterface
$context) { $ids =
[];
foreach ($products as $product) { $ids[] =
$product->
getId();
}