Download the PHP package deadmantfa/yii2-relation-trait without Composer
On this page you can find all versions of the php package deadmantfa/yii2-relation-trait. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download deadmantfa/yii2-relation-trait
More information about deadmantfa/yii2-relation-trait
Files in deadmantfa/yii2-relation-trait
Package yii2-relation-trait
Short Description Yii 2 Models load with relation & transaction save with relation (plus optional soft-delete/restore).
License BSD-3-Clause
Homepage https://github.com/deadmantfa/yii2-relation-trait
Informations about the package yii2-relation-trait
yii2-relation-trait
Note: This is not the official extension by @mootensai.
I am not the creator of the original extension. I have made bug fixes and improvements that suit my use case.
Feel free to use it or refer to the official package at mootensai/yii2-relation-trait.
Yii 2 Models add functionality for loading related models via loadAll($POST) and transactional saving via
saveAll().
It also supports soft delete and soft restore features.
Works best with mootensai/yii2-enhanced-gii.
Badges
Installation
The preferred way to install this extension is through Composer.
Either run
or add
to the require section of your application's file.
Usage in the Model
Controller Usage
The extension expects a normal array of POST data. For example:
In your controller:
Features
- Transaction Support a. Your data changes are atomic (ACID compliant).
- Normal a. Behaviors still work as usual since it’s built on top of Yii’s .
-
Validation a. Errors from related models appear via , e.g.
- UUID or Auto-Increment Works with any PK strategy, including mootensai/yii2-uuid-behavior.
- Soft Delete By defining in your model constructor (and for restoring), you can softly mark rows as deleted instead of physically removing them.
Array Outputs
Produces a POST-like structure with the main model and related arrays.
Produces a nested structure under .
Contributing or Reporting Issues
Please open an issue or submit a PR if you find a bug or have an improvement idea.
Disclaimer
This package is a fork or an alternative to mootensai/yii2-relation-trait. All credit to @mootensai for the initial code. This is not meant to replace the original package but rather provide bug fixes and enhancements under a different namespace.