goodizer / yii2-helpers
An advanced Yii 2 helpers.
Installs: 139
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-helpers
Requires
- yiisoft/yii2: ~2.0@stable
README
Installation
The preferred way to install this extension is through composer.
Note: Check the composer.json for this extension's requirements and dependencies.
Either run
$ php composer.phar require goodizer/yii2-helpers
or add
"goodizer/yii2-helpers": "*"
to the require
section of your composer.json
file.
Usage
GridSearchHelper
Create ActiveDataProvider object and build query by GET|POST data validated in model, which will be in filterModel property for GridView, ListView, etc.
use goodizer\helpers\GridSearchHelper; use yii\grid\GridView; $searchData = GridSearchHelper::search(new Note()); echo GridView::widget([ 'columns' => [ 'id', 'name', 'etc', ], 'filterModel' => $searchData->filterModel, 'dataProvider' => $searchData->dataProvider, ]);
DbSyncHelper
Create or modify tables by model attribute types. Also can add CONSTRAINT REFERENCES.
use goodizer\helpers\DbSyncHelper; $sync = new DbSyncHelper([ 'common\models', 'modules\admin\models', 'some\another\namespace', ]); $sync->run();