<?php

class SalesReturnItems extends CActiveRecord
{
    public function tableName()
    {
        return 'crm_sales_return_items';
    }

    public function rules()
    {
        return [
            ['return_id, invoice_item_id, product_id, sku, product_name, sold_qty, return_qty', 'required'],
            ['sold_qty, return_qty, unit_price', 'numerical'],
            ['sku, product_name','length','max'=>255]
        ];
    }

    public function relations()
    {
        return [
            'return'=>[self::BELONGS_TO,'SalesReturn','return_id']
        ];
    }

    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }
}