| @@ 120-132 (lines=13) @@ | ||
| 117 | 'class' => RenderAction::class, |
|
| 118 | 'data' => $this->data, |
|
| 119 | 'view' => $this->view, |
|
| 120 | 'params' => function ($action) { |
|
| 121 | $models = $this->fetchModels(); |
|
| 122 | if (empty($models)) { |
|
| 123 | throw new NotFoundHttpException('Search result is empty.'); |
|
| 124 | } |
|
| 125 | foreach ($models as $model) { |
|
| 126 | $model->scenario = $this->scenario; |
|
| 127 | } |
|
| 128 | return [ |
|
| 129 | 'models' => $models, |
|
| 130 | 'model' => reset($models), |
|
| 131 | ]; |
|
| 132 | }, |
|
| 133 | ], |
|
| 134 | 'GET ajax' => [ |
|
| 135 | 'success' => [ |
|
| @@ 139-148 (lines=10) @@ | ||
| 136 | 'class' => RenderAjaxAction::class, |
|
| 137 | 'data' => $this->data, |
|
| 138 | 'view' => $this->view, |
|
| 139 | 'params' => function ($action) { |
|
| 140 | $models = $this->fetchModels(); |
|
| 141 | foreach ($models as $model) { |
|
| 142 | $model->scenario = $this->scenario; |
|
| 143 | } |
|
| 144 | return [ |
|
| 145 | 'models' => $models, |
|
| 146 | 'model' => reset($models), |
|
| 147 | ]; |
|
| 148 | }, |
|
| 149 | ], |
|
| 150 | ], |
|
| 151 | 'POST html' => [ |
|