bscheshirwork / yii2-gui-acyclic-graphs
Yii 2 模型管理 GUI 界面
2.0.8
2018-06-13 11:01 UTC
Requires
- php: >=7.1.0
- yiisoft/yii2: >=2.0.12
- yiisoft/yii2-bootstrap: >=2.0.8
This package is auto-updated.
Last update: 2024-09-08 06:43:42 UTC
README
例如,对于下一个组合
/** * @property MainModel[] $parents * @property MainModel[] $childs */ class MainModel extends \yii\db\ActiveRecord { var $id; } /** * @property MainModel $parent * @property MainModel $child */ class RelationModel extends \yii\db\ActiveRecord { var $parentId; var $childId; }
通过表属性可以前缀 parent、child,可以接受复杂的 pk;
图形表示和操作
如何安装
遵循以下命令
- 将以下代码添加到您的 composer.json 中
"bscheshirwork/yii2-gui-acyclic-graphs": "*@dev" - 运行
composer update - 将以下代码添加到
config中
// '/config/web.php' for Basic or '/backend/config/main' - Advanced Yii2 application. 'modules' => [ 'gui' => [ 'class' => 'bscheshirwork\gui\Module', 'as access' => [ // if you need to set access 'class' => 'yii\filters\AccessControl', 'rules' => [ [ 'allow' => true, 'roles' => ['@'] // all auth users ], ], ], 'mainModel' => 'common\models\MainModel', // model, who have relations. (rectangles) 'mainModelFormView' => '@backend/views/main-model/_form-gui', //Active form for MainModel. See @vendor/bscheshirwork/yii2-gui-acyclic-graphs/src/views/default/_form 'relationModel' => 'common\models\RelationModel', // via model (arrows) 'arrowDirection' => bscheshirwork\gui\Module::PARENT_TO_CHILD, // direction of arrow representation ], ],
- 转到 URL
/index.php?r=gui
