File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 6060 {
6161 return [
6262 'cron' => 'yii2mod\cron\actions\CronLogAction',
63+ // Also you can override some action properties in following way:
64+ 'searchClass' => [
65+ 'class' => 'yii2mod\cron\models\search\CronScheduleSearch',
66+ 'pageSize' => 10
67+ ],
68+ 'view' => 'custom name of the view, which should be rendered.'
6369 ];
6470 }
6571```
Original file line number Diff line number Diff line change 44
55use Yii ;
66use yii \base \Action ;
7- use yii2mod \cron \models \search \CronScheduleSearch ;
87
98/**
109 * Class CronLogAction
@@ -17,12 +16,17 @@ class CronLogAction extends Action
1716 */
1817 public $ view = '@vendor/yii2mod/yii2-cron-log/views/index ' ;
1918
19+ /**
20+ * @var string search class name for searching
21+ */
22+ public $ searchClass = 'yii2mod\cron\models\search\CronScheduleSearch ' ;
23+
2024 /**
2125 * Lists of all cron logs.
2226 */
2327 public function run ()
2428 {
25- $ searchModel = new CronScheduleSearch ( );
29+ $ searchModel = Yii:: createObject ( $ this -> searchClass );
2630 $ dataProvider = $ searchModel ->search (Yii::$ app ->request ->queryParams );
2731
2832 return $ this ->controller ->render ($ this ->view , [
Original file line number Diff line number Diff line change 1111 */
1212class CronScheduleSearch extends CronScheduleModel
1313{
14+ /**
15+ * @var int the default page size.
16+ */
17+ public $ pageSize = 25 ;
18+
1419 /**
1520 * @inheritdoc
1621 */
@@ -36,7 +41,7 @@ public function search($params)
3641 'query ' => $ query ,
3742 'sort ' => ['defaultOrder ' => ['id ' => SORT_DESC ]],
3843 'pagination ' => [
39- 'pageSize ' => 20
44+ 'pageSize ' => $ this -> pageSize
4045 ]
4146 ]);
4247
You can’t perform that action at this time.
0 commit comments