PHP code example of yiisoft-custom / yii2-model-attribute-convert
1. Go to this page and download the library: Download yiisoft-custom/yii2-model-attribute-convert library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yiisoft-custom / yii2-model-attribute-convert example snippets
class Test extends ActiveRecord
{
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['attribute_convert'] = [
'class' => AttributeConverted::class,
'cast' => [
'order_no' => 'Array',
]
];
return $behaviors;
}
}