/** * @param ProductInterface $product * @param AssociationTypeInterface $type * * @return array */ protected function getAssociatedProductIds(ProductInterface $product, AssociationTypeInterface $type) { $productIds = []; $association = $product->getAssociationForType($type); if ($association) { foreach ($association->getProducts() as $product) { $productIds[] = $product->getId(); } } return $productIds ?: [0]; }