File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 1212 */
1313trait FindModelTrait
1414{
15- /**
16- * @var string message for the NotFoundHttpException
17- */
18- protected $ notFoundMessage = 'The requested page does not exist. ' ;
19-
2015 /**
2116 * Finds model
2217 *
2318 * @param $modelClass ActiveRecord
2419 * @param mixed $condition primary key value or a set of column values
20+ * @param string $notFoundMessage
2521 * @return ActiveRecord
22+ *
2623 * @throws NotFoundHttpException
2724 */
28- protected function findModel ($ modelClass , $ condition )
25+ protected function findModel ($ modelClass , $ condition, $ notFoundMessage = ' The requested page does not exist. ' )
2926 {
3027 if (($ model = $ modelClass ::findOne ($ condition )) !== null ) {
3128 return $ model ;
3229 } else {
33- throw new NotFoundHttpException ($ this -> notFoundMessage );
30+ throw new NotFoundHttpException ($ notFoundMessage );
3431 }
3532 }
36- }
33+ }
You can’t perform that action at this time.
0 commit comments