コード例 #1
0
ファイル: PriceHydrator.php プロジェクト: GerDner/luck-docker
 /**
  * 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;
 }
コード例 #2
0
 /**
  * @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;
 }