shamanzpua / entity-change-log-behavior
There is no license information available for the latest version (1.0.3) of this package.
Yii2 Behavior. Logger for entity changes
Package info
github.com/shamanzpua/entity-change-log-behavior
pkg:composer/shamanzpua/entity-change-log-behavior
1.0.3
2017-04-12 20:40 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2026-03-01 00:23:13 UTC
README
Logs models state before and after change
Installation
Add to composer.json
"require": {
"shamanzpua/entity-change-log-behavior": "*"
}
Usage:
public function behaviors() { return [ [ 'class' => EntityChangeLogBehavior::class, 'logModelClass' => Log::class, //ActiveRecord log table class 'attributes' => [ //attributes of owner. Default: all attributes 'name', 'date', 'id', ], 'columns' => [ //Required log table columns 'action' => 'action_column_name' // Default 'action', 'new_value' => 'new_value_column_name' // Default 'new_value', 'old_value' => 'old_value_column_name' // Default 'old_value', ], 'relatedAttributes' => [ //attributes of owners relations 'user' => ['email'], 'category' => ['name'], ], 'additionalLogTableFields' => [ //additional log table fields. key -> log table col, value -> owners col 'log_item_name' => 'title', ], ] ]; }