You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simple-yewu/common/models/YearT.php

70 lines
1.4 KiB

5 years ago
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "year_t".
*
* @property integer $id
* @property string $name
* @property integer $displacement_id
* @property integer $series_id
* @property string $created_at
* @property string $updated_at
*/
class YearT extends \common\models\Base
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'year_t';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name'], 'required'],
[['displacement_id', 'series_id'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
[['name'], 'string', 'max' => 50],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => 'Name',
'displacement_id' => 'Displacement ID',
'series_id' => 'Series ID',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
public function getDisplacement()
{
return $this->hasOne(DisplacementT::className(),['id'=>'displacement_id']);
}
public function getSeries()
{
return $this->hasOne(Series2T::className(),['id'=>'series_id']);
}
public function getModels()
{
return $this->hasMany(ModelT::className(),['year_id'=>'id']);
}
}