/** * Hydrates the data result of the cheapest price query. * This function uses the normally hydrate function of this class * and adds additionally the product unit information to the price. * * @param array $data * @return Struct\Product\PriceRule */ public function hydrateCheapestPrice(array $data) { $price = $this->hydratePriceRule($data); $data = array_merge($data, $this->getVariantTranslation($data)); $unit = $this->unitHydrator->hydrate($data); $price->setUnit($unit); return $price; }
/** * @param Struct\ListProduct $product * @param array $data * @return Struct\ListProduct */ private function assignData(Struct\ListProduct $product, array $data) { $translation = $this->getProductTranslation($data); $data = array_merge($data, $translation); $this->assignProductData($product, $data); $product->setTax($this->taxHydrator->hydrate($data)); $this->assignPriceGroupData($product, $data); if ($data['__product_supplierID']) { $product->setManufacturer($this->manufacturerHydrator->hydrate($data)); } if ($data['__esd_id']) { $product->setEsd($this->esdHydrator->hydrate($data)); } $product->setUnit($this->unitHydrator->hydrate($data)); if (!empty($data['__productAttribute_id'])) { $this->assignAttributeData($product, $data); } return $product; }