<?php
    
    namespace common\models\blog;
    
    use artbox\core\models\Alias;
    use yii\db\ActiveRecord;
    use artbox\core\models\Language;
    
    /**
     * This is the model class for table "blog_category_lang".
     *
     * @property integer  $id
     * @property integer  $blog_category_id
     * @property integer  $language_id
     * @property string   $title
     * @property string   $description
     * @property Category $category
     * @property Language $language
     */
    class CategoryLang extends ActiveRecord
    {
        /**
         * @inheritdoc
         */
        public static function tableName()
        {
            return 'blog_category_lang';
        }
        
        /**
         * @inheritdoc
         */
        public function rules()
        {
            return [
                [
                    [
                        'title',
                    ],
                    'required',
                ],
                [
                    [ 'description' ],
                    'string',
                ],
                [
                    [
                        'title',
                    ],
                    'string',
                    'max' => 255,
                ],
            ];
        }
        
        /**
         * @inheritdoc
         */
        public function attributeLabels()
        {
            return [
                'id'               => 'ID',
                'blog_category_id' => 'Blog Category ID',
                'language_id'      => 'Language ID',
                'title'            => \Yii::t('core', 'Title'),
                'alias'            => 'Alias',
                'description'      => \Yii::t('core', 'Description'),
                'meta_title'       => 'Meta Title',
                'meta_description' => 'Meta Description',
                'h1'               => 'H1',
                'seo_text'         => 'Seo Text',
            ];
        }
        
        /**
         * @return \yii\db\ActiveQuery
         */
        public function getCategory()
        {
            return $this->hasOne(Category::className(), [ 'id' => 'blog_category_id' ]);
        }
        
        public function getAlias()
        {
            return $this->hasOne(Alias::className(), [ 'id' => 'alias_id' ]);
        }
        
    }
