Import.php 2.03 KB
<?php
    
    namespace artbox\catalog\models;
    
    use artbox\core\models\Image;
    use yii\db\ActiveRecord;
    
    /**
     * Class Import
     *
     * @package artbox\catalog\models
     * @property string       $category_name
     * @property string       $brand_name
     * @property string       $image_link
     * @property string       $image_name
     * @property string       $sku
     * @property string       $product_name
     * @property Image        $image
     * @property Variant      $variant
     * @property CategoryLang $categoryLang
     * @property BrandLang    $brandLang
     * @property string       $description
     * @property double       $price
     * @property double       $price_old
     * @property integer      $stock
     * @property integer      $mask
     * @property string       $video
     * @property string       $characteristics
     */
    class Import extends ActiveRecord
    {
        public $categoryId = null;
    
        public $brandId = null;
    
        public $imageId = null;
    
        public $groups = [];
        
        /**
         * @inheritdoc
         */
        public static function tableName()
        {
            return 'import';
        }
    
        /**
         * @return \yii\db\ActiveQuery
         */
        public function getVariant()
        {
            return $this->hasOne(Variant::className(), [ 'sku' => 'sku' ]);
        }
    
        /**
         * @return \yii\db\ActiveQuery
         */
        public function getCategoryLang()
        {
            return $this->hasOne(CategoryLang::className(), [ 'title' => 'category_name' ]);
        }
    
        /**
         * @return \yii\db\ActiveQuery
         */
        public function getBrandLang()
        {
            return $this->hasOne(BrandLang::className(), [ 'title' => 'brand_name' ]);
        }
    
        /**
         * @return \yii\db\ActiveQuery
         */
        public function getImage()
        {
            return $this->hasOne(Image::className(), [ 'fileName' => 'image_name' ]);
        }
    }