Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 811 Bytes

README.md

File metadata and controls

36 lines (26 loc) · 811 Bytes

Yii2 Array Field Behavior

This Yii2 model behavior allows you to store arrays in attributes.

Installation

Run the Composer command to install the latest stable version:

composer require frostealth/yii2-array-field @stable

Usage

Just attach the behavior to your model.

use frostealth\yii2\behaviors\ArrayFieldBehavior;

public function behaviors()
{
    return [
        [
            'class' => ArrayFieldBehavior::className(),
            'attributes' => ['attribute1', 'attribute2'],
            // 'defaultEncodedValue' => null,
            // 'defaultDecodedValue' => [],
        ],
    ];
}

License

The MIT License (MIT). See LICENSE.md for more information.