Ejemplo n.º 1
0
 public function getApplications()
 {
     if (in_array($this->type, [1, 2, 3])) {
         return Applications::find()->select(['title'])->indexBy('id')->column();
     }
     return null;
 }
Ejemplo n.º 2
0
 public function actionAbc($a, $b, $c)
 {
     if (($app = Applications::find()->where(['name' => $a])->one()) !== null) {
         if (($parent_cat = Categories::find()->where(['app_id' => $app->id, 'alias' => $b])->one()) !== null) {
             // приложение -> категория по алиасу
             if (($category = Categories::find()->where(['app_id' => $app->id, 'parent_id' => $parent_cat->id, 'alias' => $c])->one()) !== null) {
                 return $this->renderCategory($category);
             } elseif (($model = Items::find()->where(['app_id' => $app->id, 'alias' => $c])->one()) !== null) {
                 // приложение -> материал по алиасу
                 return $this->renderItem($model);
             } elseif (($model = Items::find()->where(['app_id' => $app->id, 'id' => $c])->one()) !== null) {
                 // приложение -> материал по ID
                 return $this->renderItem($model);
             }
         }
     } else {
         if (($category = Categories::find()->where(['app_id' => 1, 'alias' => $a])->one()) !== null) {
             if (($model = Items::find()->where(['app_id' => 1, 'alias' => $b])->one()) !== null && $model->parentCategory->alias == $a) {
                 // приложение -> материал по алиасу
                 return $this->renderItem($model);
             } elseif (($model = Items::find()->where(['app_id' => 1, 'id' => $b])->one()) !== null && $model->parentCategory->alias == $a) {
                 // приложение -> материал по ID
                 return $this->renderItem($model);
             }
         }
         // категория дефолтного приложения -> материал
     }
     throw new NotFoundHttpException('The requested page does not exist.');
 }
Ejemplo n.º 3
0
 public function getApplications()
 {
     return Applications::find()->select(['title'])->indexBy('id')->column();
 }
Ejemplo n.º 4
0
 public function getApplications()
 {
     return Applications::find()->where(['app_alias' => [$this->frontendPath, '@app']])->indexBy('id')->all();
 }