<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "series_t".
 *
 * @property integer $id
 * @property string $name
 * @property integer $brand_id
 * @property string $created_at
 * @property string $updated_at
 */
class SeriesT extends \common\models\Base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'series_t';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['brand_id'], 'required'],
            [['brand_id'], 'integer'],
            [['created_at', 'updated_at'], 'safe'],
            [['name'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'brand_id' => 'Brand ID',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }

    public function getBrand()
    {
        return $this->hasOne(BrandT::className(),['id'=>'brand_id']);
    }

    public function getDisplacements()
    {
        return $this->hasMany(DisplacementT::className(),['series_id'=>'id']);
    }
}