m-comscience / yii2-core-multi-value-behavior
Active Record Behaviors for Yii Framework
Package info
github.com/MComScience/yii2-core-multi-value-behavior
Type:yii2-extension
pkg:composer/m-comscience/yii2-core-multi-value-behavior
dev-master
2018-11-18 13:12 UTC
Requires
- yiisoft/yii2: ~2.0.14
This package is auto-updated.
Last update: 2026-03-19 14:09:00 UTC
README
Yii2 Active Record Behaviors
Installation
The preferred way to install this extension is through composer.
Install
composer require m-comscience/yii2-core-multi-value-behavior
Usage
model
use mcomscience\behaviors\CoreMultiValueBehavior; public function behaviors() { return [ [ 'class' => CoreMultiValueBehavior::className(), 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['attribute1'], ActiveRecord::EVENT_BEFORE_UPDATE => ['attribute2'], ], 'value' => function ($event) { return $event->sender[$event->data]; }, ], ]; }