Skip to content

frostealth/yii2-array-field

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.