Ejemplo n.º 1
0
 /**
  * Finds the providers model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return providers the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = providers::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 2
0
 public function actionFinish($providerId)
 {
     $filename = $providerId . '.csv';
     // Проверить, существует ли поставщик
     if (($provider = providers::findOne($providerId)) !== null) {
         // если есть - получить таблицу соотвертсвий полей прайса
         $metaProv = $provider->meta ? unserialize($provider->meta) : [];
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     $FindAccords = new FindAccords($providerId, $filename, $metaProv['accords']);
     $arRes = $FindAccords->run();
     Yii::$app->cache->delete($arRes['key']);
     unlink(Yii::$app->params['uploadFolder'] . $providerId . '.csv');
     $this->redirect('/');
 }