|
|
@ -4,6 +4,7 @@ namespace antgoods\goods\models\ars; |
|
|
|
|
|
|
|
use Yii; |
|
|
|
use yii\behaviors\TimestampBehavior; |
|
|
|
use antgoods\goods\models\ars\Category; |
|
|
|
|
|
|
|
/** |
|
|
|
* This is the model class for table "antgoods_attribute". |
|
|
@ -16,6 +17,7 @@ use yii\behaviors\TimestampBehavior; |
|
|
|
* @property int $is_delete 是否删除,1为已删除 |
|
|
|
* @property int $created_at 创建时间 |
|
|
|
* @property int $updated_at 更新时间 |
|
|
|
* @property int $cat_id 后台商品分类id |
|
|
|
*/ |
|
|
|
class Attribute extends \yii\db\ActiveRecord |
|
|
|
{ |
|
|
@ -40,7 +42,7 @@ class Attribute extends \yii\db\ActiveRecord |
|
|
|
return [ |
|
|
|
[['name', 'value'], 'required'], |
|
|
|
[['value'], 'string'], |
|
|
|
[['type', 'sort_order', 'is_delete'], 'integer'], |
|
|
|
[['type', 'sort_order', 'is_delete', 'cat_id'], 'integer'], |
|
|
|
[['name'], 'string', 'max' => 50], |
|
|
|
]; |
|
|
|
} |
|
|
@ -59,6 +61,7 @@ class Attribute extends \yii\db\ActiveRecord |
|
|
|
'is_delete' => '是否删除,1为已删除', |
|
|
|
'created_at' => '创建时间', |
|
|
|
'updated_at' => '更新时间', |
|
|
|
'cat_id' => '后台商品分类id', |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
@ -100,4 +103,9 @@ class Attribute extends \yii\db\ActiveRecord |
|
|
|
} |
|
|
|
return parent::beforeSave($insert); // TODO: Change the autogenerated stub
|
|
|
|
} |
|
|
|
|
|
|
|
public function getCategory() |
|
|
|
{ |
|
|
|
return $this->hasOne(Category::className(), ['id' => 'cat_id']); |
|
|
|
} |
|
|
|
} |