/**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->slider_id === null && $this->slider_name === null && $this->slider === null) {
         throw new InvalidConfigException("Either slider, slider_id or slider_name should be set.");
     }
     if ($this->slider === null) {
         if ($this->slider_name !== null) {
             $this->slider = Yii::$app->cache->get("Slider:name:" . $this->slider_name);
             if ($this->slider === false) {
                 $this->slider = Slider::find()->where(['name' => $this->slider_name])->one();
                 Yii::$app->cache->set("Slider:name:" . $this->slider_name, $this->slider, 86400, new \yii\caching\TagDependency(['tags' => [ActiveRecordHelper::getCommonTag(Slider::className())]]));
             }
         } else {
             $this->slider = Slider::findById($this->slider_id);
         }
     }
 }
 /**
  * Finds the Slider model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Slider the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Slider::findById($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }