Download the PHP package rahulabs/yii2-softdelete without Composer
On this page you can find all versions of the php package rahulabs/yii2-softdelete. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rahulabs/yii2-softdelete
More information about rahulabs/yii2-softdelete
Files in rahulabs/yii2-softdelete
Package yii2-softdelete
Short Description Soft delete extension for Yii2 framework
License MIT
Informations about the package yii2-softdelete
Yii2 SoftDelete
Soft delete extension for Yii2 framework.
This extension ensures that soft-deleted has delete native consistent behavior and is IDE-friendly.
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
Edit model class:
Change database table structures, add deleted_at (int 11)
field and attached to UNIQUE index.
API
ActiveRecord class (SoftDelete Trait):
The find series method will return rahulabs\softdelete\ActiveQuery
Object.
- softDelete() Deleting data using soft delete mode
- forceDelete() Use physical deletion mode to force delete data
- restore() Recover soft deleted model data
- isTrashed() Whether it is soft deleted
The following commands are find()
/ findOne()
/ findAll()
Corresponding versions in different modes :
All models (including soft deleted ones):
- findWithTrashed()
- findOneWithTrashed($condition)
- findAllWithTrashed($condition)
Find only soft deleted models :
- findOnlyTrashed()
- findOneOnlyTrashed($condition)
- findAllOnlyTrashed($condition)
The following commands have been rewritten as soft delete versions :
- find()
- findOne()
- findAll()
- delete()
rahulabs\softdelete\ActiveQuery
increased withTrashed()
, withoutTrashed()
and onlyTrashed()
Three methods,
Set the corresponding search mode。