credy/yii2-rename-behavior
最新稳定版本:1.0.0
Composer 安装命令:
composer require credy/yii2-rename-behavior
包简介
Rename attributes on models.
README 文档
README
With this behavior, you can rename attributes on components in Yii2
Usage
public function behaviors()
{
return [
'renameBehavior' => \credy\behavior\rename\RenameBehavior::class,
'renames' => [
'renamedAttributeName' => 'realAttributeName'
]
]
}
You can also define get and set methods that modify the data
public function behaviors()
{
return [
'renameBehavior' => \credy\behavior\rename\RenameBehavior::class,
'renames' => [
'renamedAttributeName' => 'realAttributeName'
],
'getMethod' => [self::class, 'getModifiedAttribute'],
'setMethod' => [self::class, 'setModifiedAttribute'],
];
}
public static function getModifiedAttribute($value, $attributeName)
{
// do some modifications here
return 'modified attribute value';
}
public static function setModifiedAttribute($value, $attributeName)
{
// do some modifications here
return 'modified attribute value';
}
统计信息
- 总下载量: 434
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-only
- 更新时间: 2025-11-11