yii2-helpers
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();