| @@ 100-112 (lines=13) @@ | ||
| 97 | * @return \modules\users\models\User the loaded model |
|
| 98 | * @throws \yii\console\Exception if the model cannot be found |
|
| 99 | */ |
|
| 100 | private function findModel($username = '') |
|
| 101 | {
|
|
| 102 | if (!empty($username)) {
|
|
| 103 | if ($model = User::findOne(['username' => $username])) {
|
|
| 104 | return $model; |
|
| 105 | } |
|
| 106 | } |
|
| 107 | throw new Exception( |
|
| 108 | Console::convertEncoding( |
|
| 109 | Yii::t('app', 'User "{:Username}" not found', [':Username' => $username])
|
|
| 110 | ) |
|
| 111 | ); |
|
| 112 | } |
|
| 113 | } |
|
| 114 | ||
| @@ 91-101 (lines=11) @@ | ||
| 88 | * @throws \yii\console\Exception |
|
| 89 | * @return User the loaded model |
|
| 90 | */ |
|
| 91 | private function findModel($username = '') |
|
| 92 | { |
|
| 93 | if (!$model = User::findOne(['username' => $username])) { |
|
| 94 | throw new Exception( |
|
| 95 | Console::convertEncoding( |
|
| 96 | Yii::t('app', 'User "{:Username}" not found', [':Username' => $username]) |
|
| 97 | ) |
|
| 98 | ); |
|
| 99 | } |
|
| 100 | return $model; |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * @param Model $model |
|