rezident / yii2-serialized-attributes-behavior
Yii2 Serialized Attributes Behavior
Package info
github.com/rezident/yii2-serialized-attributes-behavior
Type:yii2-extension
pkg:composer/rezident/yii2-serialized-attributes-behavior
v1.1.2
2016-03-08 08:43 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2026-03-01 00:21:55 UTC
README
This Yii2 model behavior allows you to store arrays in attributes. To attach the behavior put the following code in your model:
public function behaviors() { return [ 'serializedAttributes' => [ 'class' => SerializedAttributes::className(), // Define the attributes you want to be serialized 'attributes' => ['serializedData', 'moreSerializedData'], // Enable this option if your DB is not in UTF-8 // (more info at http://www.jackreichert.com/2014/02/02/handling-a-php-unserialize-offset-error/) // 'encode' => true, ], ]; }