<?php

namespace common\models;

use common\modules\product\models\ProductVariant;
use Yii;

class OrdersProducts extends \yii\db\ActiveRecord
{
    public static function tableName()
    {
        return 'orders_products';
    }
    
    public function rules()
    {
        return [
            [['order_id'], 'required'],
            //['email', 'email'],
            [['product_name','name','price','count','sum_cost','mod_id','sku'], 'safe'],
        ];
    }
    
    
	public function attributeLabels()
	{
		return [
			'product_name'=>Yii::t('app', 'product_name'),
			'name'=>Yii::t('app', 'op_name'),
            'art'=>Yii::t('app', 'art'),
            'cost'=>Yii::t('app', 'cost'),
			'count'=>Yii::t('app', 'count'),
            'sum_cost'=>Yii::t('app', 'sum_cost'),
		];
	}

    public function getProductVariant()
    {
        return $this->hasOne(ProductVariant::className(), ['product_variant_id' => 'mod_id']);
    }
}  