/**
  * Сохраняем результаты из массива
  *
  * @param $result
  * @param $link
  */
 private function saveResult($result, $link)
 {
     foreach ($result['items'] as $item) {
         if (!empty($item['article'])) {
             $product = IledebeauteProduct::findOne(['article' => $item['article']]);
             if (!$product) {
                 $product = new IledebeauteProduct();
             }
             $product->brand = $this->clearBrand($result['brand']);
             $product->title = $result['title'];
             $product->article = $item['article'];
             $product->showcases_new = $item['showcases_new'];
             $product->showcases_sale = $item['showcases_sale'];
             $product->showcases_exclusive = $item['showcases_exclusive'];
             $product->showcases_limit = $item['showcases_limit'];
             $product->showcases_best = $item['showcases_best'];
             $product->new_price = $this->getPrice($item['price']['newPrice']);
             $product->old_price = $this->getPrice($item['price']['oldPrice']);
             $product->category = $link['category'];
             $product->group = $link['group'];
             $product->link = $link['link'];
             $product->sub_category = $link['sub_category'];
             $product->image_link = $item['image'];
             $product->description = $item['description'];
             $product->deleted_at = '0000-00-00 00:00:00';
             $price = new IledebeautePrice();
             $price->article = $item['article'];
             $price->new_price = $this->getPrice($item['price']['newPrice']);
             $price->old_price = $this->getPrice($item['price']['oldPrice']);
             if (!empty($price) && $product->save()) {
                 $price->save();
             }
         }
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIledebeautePrices()
 {
     return $this->hasMany(IledebeautePrice::className(), ['article' => 'article']);
 }