1 | <?php |
||
2 | |||
3 | namespace carono\yii2crud\actions; |
||
4 | |||
5 | use carono\yii2crud\CrudController; |
||
6 | use yii\helpers\Html; |
||
7 | use Yii; |
||
8 | |||
9 | /** |
||
10 | * Class UpdateAction |
||
11 | * |
||
12 | * @package carono\yii2crud\actions |
||
13 | * @property CrudController $controller |
||
14 | * @method getMessageOnUpdate(\yii\db\ActiveRecord $model) |
||
15 | */ |
||
16 | class UpdateAction extends Action |
||
17 | { |
||
18 | public $view = 'update'; |
||
19 | public $messageOnUpdate = 'Model Successful Updated'; |
||
20 | |||
21 | public function run($id) |
||
22 | { |
||
23 | $model = $this->controller->findModel($id, $this->controller->updateClass); |
||
24 | if ($model->load(Yii::$app->request->post())) { |
||
25 | if ($model->save()) { |
||
26 | Yii::$app->session->setFlash('success', $this->getMessageOnUpdate($model)); |
||
0 ignored issues
–
show
|
|||
27 | $url = $this->controller->updateRedirect($model); |
||
28 | if (Yii::$app->request->isPjax) { |
||
29 | return Yii::$app->response->redirect($url, 302, false); |
||
30 | } |
||
31 | return $this->controller->redirect($url); |
||
32 | } |
||
33 | Yii::$app->session->setFlash('error', Html::errorSummary($model)); |
||
34 | } |
||
35 | return $this->controller->render($this->view, ['model' => $model]); |
||
36 | } |
||
37 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.