/**
  * @param Response $result
  */
 private function saveElizeResult(Response $result)
 {
     $product = ElizeProduct::findOne(['article' => $result->getArticle()]);
     if (!$product) {
         $product = new ElizeProduct();
     }
     $product->attributes = $result->toArray();
     $product->new_price = !empty($result->getNewPrice()) ? $result->getNewPrice() : null;
     $product->old_price = !empty($result->getPrice()) ? $result->getPrice() : null;
     $product->deleted_at = '0000-00-00 00:00:00';
     try {
         $ePrice = new ElizePrice();
         $ePrice->article = $result->getArticle();
         $ePrice->old_price = $product->old_price;
         $ePrice->new_price = $product->new_price;
         if ($product->save()) {
             $ePrice->save();
         } else {
             \Yii::error(sprintf('Ошибка сохранения артикула E: %s data: %s', $result->getArticle(), json_encode($result->toArray())), 'cron');
         }
     } catch (\Exception $e) {
         \Yii::error(sprintf('Exception %s сохранения артикула E %s data: %s', $e->getMessage(), $result->getArticle(), json_encode($result->toArray())), 'cron');
     }
 }
 /**
  * Finds the ElizeProduct model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ElizeProduct the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ElizeProduct::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }