1 | <?php |
||
8 | trait ModelTrait |
||
9 | { |
||
10 | /** |
||
11 | * Find the model based on its primary key value or WHERE condition. |
||
12 | * If the model is not found or access denied, a 404 HTTP exception will be thrown. |
||
13 | * |
||
14 | * @param ActiveRecord $model |
||
15 | * @param int|array $id primary key or WHERE condition |
||
16 | * @param callable $checkAccess |
||
17 | * @return ActiveRecord |
||
18 | * @throws NotFoundHttpException |
||
19 | */ |
||
20 | public function findModel($model, $id, $checkAccess = null) |
||
30 | |||
31 | /** |
||
32 | * Collect model errors |
||
33 | * |
||
34 | * @param Model $model the model to be validated |
||
35 | * @return array the error message array indexed by the attribute IDs. |
||
36 | */ |
||
37 | public static function collectErrors($model) |
||
49 | } |
||
50 |