execut / yii2-crud-fields
基于kartik dynagrid和detailView的CRUD标准字段逻辑行为
0.56.6
2022-04-08 09:11 UTC
Requires
- php: ^7.4
- execut/yii2-base: *
- execut/yii2-kcfinder: *
- execut/yii2-save-relations-behavior: *
- kartik-v/yii2-date-range: *
- kartik-v/yii2-detail-view: *
- kartik-v/yii2-widget-select2: *
- sammaye/yii2-qtip: dev-master as 0.1.0
- unclead/yii2-multiple-input: *
- yiisoft/yii2: 2.*
- yiisoft/yii2-imagine: *
Requires (Dev)
- codeception/codeception: ^4.0
- codeception/module-asserts: ^1.0
- codeception/module-filesystem: ^1.0
- codeception/module-yii2: ^1.0
- codeception/verify: ~0.5.0 || ~1.1.0
- execut/yii2-crud: *
- execut/yii2-settings: *
- dev-master
- 0.56.6
- 0.56.5
- 0.56.4
- 0.56.3
- 0.56.2
- 0.56.1
- 0.56.0
- 0.55.0
- 0.54.6
- 0.54.5
- 0.54.4
- 0.54.3
- 0.54.2
- 0.54.1
- 0.54.0
- 0.53.3
- 0.53.2
- 0.53.1
- 0.53.0
- 0.52.10
- 0.52.9
- 0.52.8
- 0.52.7
- 0.52.6
- 0.52.5
- 0.52.4
- 0.52.3
- 0.52.2
- 0.52.1
- 0.52.0
- 0.51.4
- 0.51.3
- 0.51.2
- 0.51.1
- 0.51.0
- 0.50.1
- 0.50.0
- 0.49.1
- 0.49.0
- 0.48.5
- 0.48.4
- 0.48.3
- 0.48.2
- 0.48.1
- 0.48.0
- 0.47.0
- 0.46.0
- 0.45.3
- 0.45.2
- 0.45.1
- 0.45.0
- 0.44.4
- 0.44.3
- 0.44.2
- 0.44.1
- 0.44.0
- 0.43.7
- 0.43.6
- 0.43.5
- 0.43.4
- 0.43.3
- 0.43.2
- 0.43.1
- 0.43.0
- 0.42.0
- 0.41.2
- 0.41.1
- 0.41.0
- 0.40.1
- 0.40.0
- 0.39.6
- 0.39.5
- 0.39.4
- 0.39.3
- 0.39.2
- 0.39.1
- 0.39.0
- 0.38.1
- 0.38.0
- 0.37.11
- 0.37.10
- 0.37.9
- 0.37.8
- 0.37.7
- 0.37.6
- 0.37.5
- 0.37.4
- 0.37.3
- 0.37.2
- 0.37.1
- 0.37.0
- 0.36.1
- 0.36.0
- 0.35.3
- 0.35.2
- 0.35.1
- 0.35.0
- 0.34.0
- 0.33.2
- 0.33.1
- 0.33.0
- 0.32.3
- 0.32.2
- 0.32.1
- 0.32.0
- 0.31.11
- 0.31.10
- 0.31.9
- 0.31.8
- 0.31.7
- 0.31.6
- 0.31.5
- 0.31.4
- 0.31.3
- 0.31.2
- 0.31.1
- 0.31.0
- 0.30.5
- 0.30.4
- 0.30.3
- 0.30.2
- 0.30.1
- 0.30.0
- 0.29.0
- 0.28.4
- 0.28.3
- 0.28.2
- 0.28.1
- 0.28.0
- 0.27.0
- 0.26.1
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.1
- 0.23.0
- 0.22.2
- 0.22.1
- 0.22.0
- 0.21.1
- 0.21.0
- 0.20.5
- 0.20.4
- 0.20.3
- 0.20.2
- 0.20.1
- 0.20.0
- 0.19.6
- 0.19.5
- 0.19.4
- 0.19.3
- 0.19.2
- 0.19.1
- 0.19.0
- 0.18.2
- 0.18.1
- 0.18.0
- 0.17.0
- 0.16.1
- 0.16.0
- 0.15.0
- 0.14.6
- 0.14.5
- 0.14.4
- 0.14.3
- 0.14.2
- 0.14.1
- 0.14.0
- 0.13.2
- 0.13.1
- 0.13.0
- 0.12.3
- 0.12.2
- 0.12.1
- 0.12.0
- 0.11.2
- 0.11.1
- 0.11.0
- 0.10.1
- 0.10.0
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.0
- 0.7.11
- 0.7.10
- 0.7.9
- 0.7.8
- 0.7.7
- 0.7.6
- 0.7.5
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.1
- 0.4.0
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.1
- 0.1.0
- dev-0.52-errors
- dev-fix-bug-with-has-many
- dev-fix-bugs
- dev-refactory
- dev-fix-bug
- dev-v0.41-fix-bug
This package is auto-updated.
Last update: 2024-09-08 15:45:19 UTC
README
此组件允许您自动化与模型一起工作的许多过程,从而减少代码重复,并因此减少了总时间
- 编写同一类型字段的验证规则
- 编写获取器以声明与其他模型的多种关系
- 验证和编辑关联记录
- 设置模型及其关联记录的编辑表单
- 自定义模型记录列表
- 翻译字段名称
- 允许通过第三方模块扩展模型,而不添加新的依赖关系
- 简化了单元测试模型的过程
有关许可信息,请参阅LICENSE-文件。
英文文档位于docs/guide/README.md。
俄文文档在这里 docs/guide-ru/README.md。
安装
安装此扩展的首选方式是通过composer。
运行
php composer.phar require execut/yii2-crud-fields
或添加
"execut/yii2-crud-fields": "dev-master"
到您的composer.json
文件的require部分。
使用方法
例如,以下几行代码在模型中
namespace execut\books\models; class Book extends \yii\db\ActiveRecord { use \execut\crudFields\BehaviorStub; public function behaviors() { return [ \execut\crudFields\Behavior::KEY => [ 'class' => \execut\crudFields\Behavior::class, 'fields' => [ 'id' => [ 'class' => \execut\crudFields\fields\Id::class, ], 'name' => [ 'class' => \execut\crudFields\fields\StringField::class, 'attribute' => 'name', 'required' => true, ] ], ], ]; } }
将使所有必要的CRUD
$model = new Book(); echo 'Validation rules for the search and edit scenario'; var_dump($model->rules()); echo 'Forming ActiveQuery based on filtering parameters and configuring ActiveDataProvider'; var_dump($model->search()); echo 'Formation of list columns settings'; var_dump($model->getGridColumns()); echo 'Formation of settings for the creation/editing form'; var_dump($model->getFormFields());
如果我们比较带有扩展的模型与没有扩展的模型的实现,我们可以看到代码量在正方向上有所变化
原生Yii2的模型(85行) 与 CRUD字段模型的模型(36行)
或者更强烈的示例,关于书籍作者
原生Yii2的模型(370行) 与 CRUD字段模型的模型(116行)
有关更多详细信息,请参阅文档docs/guide/README.md。
有关更详细的信息,请参阅文档docs/guide-ru/README.md。