冻痕/yii2-array-field

允许您在属性中存储数组的特性

安装数: 9,294

依赖者: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 2

开放问题: 1

类型:yii2-extension

v1.0.2 2015-11-11 13:25 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:04:08 UTC


README

这个 Yii2 模型行为允许您在属性中存储数组。

安装

运行以下 Composer 命令以安装最新稳定版本

composer require frostealth/yii2-array-field @stable

使用方法

只需将行为附加到您的模型即可。

use frostealth\yii2\behaviors\ArrayFieldBehavior;

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

许可证

MIT 许可证(MIT)。更多信息请见 LICENSE.md