Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bscheshirwork/yii2-gui-acyclic-graphs
gui for parent-child relations
https://github.com/bscheshirwork/yii2-gui-acyclic-graphs
Last synced: about 1 month ago
JSON representation
gui for parent-child relations
- Host: GitHub
- URL: https://github.com/bscheshirwork/yii2-gui-acyclic-graphs
- Owner: bscheshirwork
- Created: 2017-07-19T09:01:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-13T15:08:28.000Z (over 6 years ago)
- Last Synced: 2024-10-19T07:46:36.460Z (2 months ago)
- Language: PHP
- Size: 142 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Graph for parent-child representation relations on self-relates activeRecord
i.e. for next composition
```php
/**
* @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](https://user-images.githubusercontent.com/5769211/28527000-eab0b6c2-7091-11e7-8efd-f1beb47f7d22.png)
similar at [githubjeka/yii2-gui-rbac](https://github.com/githubjeka/gui-rbac-yii2)
![http://i.imgur.com/BXTKymp.jpg](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:
```php
// '/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`