gvasilopulos / yii2-enhanced-gii
生成关系型(hasMany, hasOne, belongsTo, & nested)模型及 CRUD。
This package is not auto-updated.
Last update: 2024-09-23 14:31:41 UTC
README
从 https://github.com/mootensai/yii2-enhanced-gii 分支出来的 Yii2 Gii (生成器)
特别适用于使用 php 通过 ramsey/uuid 生成的 uuid id 的 postgres。
您必须将其添加到您的配置 db 连接设置中,以便正确检测 uuid 列。
'schemaMap' => [
'pgsql'=> [
'class'=>'gvasilopulos\enhancedgii\db\pgsql\Schema',
'defaultSchema' => 'public' //specify your schema here
],
],
您可以更改模式名称为您需要的任何名称。
安装
安装此扩展的首选方法是通过 composer。
运行以下命令:
$ composer require gvasilopulos/yii2-enhanced-gii:dev-master $ composer require kartik-v/yii2-mpdf:dev-master # if you want to use pdf exporter $ composer require kartik-v/yii2-tree-manager:dev-master # if you want to use tree/nested relation table
或者添加以下内容:
"gvasilopulos/yii2-enhanced-gii": "dev-master",
"kartik-v/yii2-mpdf": "dev-master",
"kartik-v/yii2-tree-manager": "dev-master"
如果您想使用 PDF 导出器,请添加
"kartik-v/yii2-mpdf": "dev-master",
如果您想使用树/嵌套关系表,请添加
"kartik-v/yii2-tree-manager": "dev-master",
到您的 composer.json 文件的 require 部分中。
我分别将 mpdf 和 tree-manager 分开,因为该包很大,并不是每个人都使用它。
然后,您必须在您的 config\main.php 中添加以下代码。
'modules' => [ ... //your another module 'gridview' => [ 'class' => '\kartik\grid\Module', // see settings on http://demos.krajee.com/grid#module ], 'datecontrol' => [ 'class' => '\kartik\datecontrol\Module', // see settings on http://demos.krajee.com/datecontrol#module ], // If you use tree table 'treemanager' => [ 'class' => '\kartik\tree\Module', // see settings on http://demos.krajee.com/tree-manager#module ] ... // your another module 'dynagrid'=> [ 'class'=>'\kartik\dynagrid\Module', // other module settings ], ],
有关 gridview 设置,请参阅 http://demos.krajee.com/grid#module
有关 datecontrol 设置,请参阅 http://demos.krajee.com/datecontrol#module
有关 treemanager 设置,请参阅 http://demos.krajee.com/tree-manager#module(如果您使用树/嵌套关系表)
如果使用 mediman CRUD 模板,请参阅 http://demos.krajee.com/dynagrid 上的 dynagrid 设置
用法
转到您的 gii 工具,并注意模型 & CRUD 的新 IO 生成器
#功能
模型
- 生成乐观锁定
- 生成时间戳行为
- 生成可归责行为
- 生成 UUID 行为并通过 php 生成 uuid(默认行为)
CRUD
- 生成所有表的 CRUD(使用通配符 (*))
- 生成相关输入输出
- 指定外键的名称/标签属性
- 设置列隐藏
- 指定跳过的列
- 指定跳过的关系
- 设置是否复数化
- 可打印的 PDF 视图
- 索引网格视图中的可展开/可折叠行,用于相关数据
- 如果选择 CRUD 中的 mediman 模板,则生成 dynagrid 网格视图(您需要在您的数据库中添加 tbl_dynagrid 和 tbl_dynagrid_dtl 表,或者在模块设置中设置适当的表,如http://demos.krajee.com/dynagrid#module 中所述)
迁移生成器
- 根据您的数据库结构生成迁移(基于:https://github.com/deesoft/yii2-gii)
待办事项
- 单页 CRUD 模板
- 实现软删除行为的生成器(《https://github.com/yii2tech/ar-softdelete》)
我欢迎任何改进
截图
模型生成器
CRUD 生成器
索引
网格视图
列表视图
视图
表单
嵌套/树
迁移生成器
感谢
- Jiwanndaru(《jiwanndaru@gmail.com》)为创建传统
- kartik-v(《https://github.com/kartik-v》)为大多数小部件
- schmunk42 (https://github.com/schmunk42) 为 bootstrap、模型基础和扩展提供支持
- mdmunir (https://github.com/mdmunir) 提供 JsBlock 和迁移生成器(源自 https://github.com/deesoft/yii2-gii)
- thamtech (https://github.com/thamtech/yii2-uuid) 提供uuid助手/验证器
- wartron (https://github.com/wartron/yii2-uuid) UUID行为
- fgh151 (https://github.com/fgh151/yii2-postgresql-array-field) 指导通过模式定制进行操作






