execut / yii2-crud-fields
A behavior for standard fields logic in CRUD based on kartik dynagrid and detailView
Installs: 1 055
Dependents: 6
Suggesters: 0
Security: 0
Stars: 8
Watchers: 4
Forks: 3
Open Issues: 0
Type:yii2-extension
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-11-08 16:16:24 UTC
README
This component allows you to automate many processes that occur in working with models, thereby reducing code duplication, and hence the total time spent:
- Writing validation rules for fields of the same type
- Writing Getters to Declare Various Relationships with Other Models
- Validating and Editing Linked Records
- Setting up the edit form for the model and its associated records
- Customizing the Model Record List
- Translating field names
- Adds the ability to extend models by a third-party module without adding new dependencies
- Simplifies the process of unit testing models
For license information check the LICENSE-file.
English documentation is at docs/guide/README.md.
Русская документация здесь docs/guide-ru/README.md.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require execut/yii2-crud-fields
or add
"execut/yii2-crud-fields": "dev-master"
to the require section of your composer.json
file.
Usage
For example, the following few lines of code in a model:
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, ] ], ], ]; } }
will make all required for 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());
If we compare the implementation of such a model with a model without extension, we can see that the amount of code has changed in a positive direction:
Model on native Yii2 (85 lines) vs Model on CRUD fields (36 lines)
Or more strong example with books authors:
Model on native Yii2 (370 lines) vs Model on CRUD fields (116 lines)
For more details please refer to the documentation docs/guide/README.md.
Для более подробной информации обращайтесь к документации docs/guide-ru/README.md.