|
|
|
@ -7,6 +7,8 @@
|
|
|
|
|
|
|
|
|
|
namespace yiiunit\data\ar; |
|
|
|
|
|
|
|
|
|
use yii\behaviors\AttributeTypecastBehavior; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Class OrderItem. |
|
|
|
|
* |
|
|
|
@ -24,6 +26,22 @@ class OrderItem extends ActiveRecord
|
|
|
|
|
return static::$tableName ?: 'order_item'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function behaviors() |
|
|
|
|
{ |
|
|
|
|
return [ |
|
|
|
|
'typecast' => [ |
|
|
|
|
'class' => AttributeTypecastBehavior::className(), |
|
|
|
|
'attributeTypes' => [ |
|
|
|
|
'order_id' => AttributeTypecastBehavior::TYPE_STRING, |
|
|
|
|
], |
|
|
|
|
'typecastAfterValidate' => false, |
|
|
|
|
'typecastAfterFind' => true, |
|
|
|
|
'typecastAfterSave' => false, |
|
|
|
|
'typecastBeforeSave' => false, |
|
|
|
|
], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getOrder() |
|
|
|
|
{ |
|
|
|
|
return $this->hasOne(Order::className(), ['id' => 'order_id']); |
|
|
|
|