bscheshirwork/yii2-gui-acyclic-graphs

Yii 2 model management GUI interface

2.0.8 2018-06-13 11:01 UTC

This package is auto-updated.

Last update: 2024-11-08 06:59:01 UTC


README

i.e. for next composition

/**
 * @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;
}

via table property can be prefixed parent, child, can accept complex pk;

graphical representation and actions:

default

similar at githubjeka/yii2-gui-rbac

http://i.imgur.com/BXTKymp.jpg

How to install

Follow the commands:

  • Add to your composer.json "bscheshirwork/yii2-gui-acyclic-graphs": "*@dev"
  • Run composer update
  • Add to config the code:
// '/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
    ],
],
  • go to url /index.php?r=gui