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/CarKeepInGoodBsdc.php

72 lines
1.7 KiB

<?php
namespace common\models;
use Yii;
use yii\db\ActiveRecord;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "car_keep_in_good_bsdc".
*
* @property integer $id
* @property integer $brand_id
* @property integer $series_id
* @property integer $displacement_id
* @property string $car_year
*/
class CarKeepInGoodBsdc extends ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'car_keep_in_good_bsdc';
}
public function scenarios()
{
return ['create'=>['brand_id','series_id','displacement_id','car_year']];
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['brand_id', 'series_id', 'displacement_id'], 'integer'],
[['car_year'], 'string', 'max' => 4],
[['brand_id', 'series_id', 'displacement_id','car_year'],'required','on'=>'create']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'brand_id' => '品牌',
'series_id' => '车系',
'displacement_id' => '排量',
'car_year' => '年份',
];
}
//品牌
public function getBrandT(){
return $this->hasOne(BrandT::className(),['id'=>'brand_id']);
}
//车型
public function getSeriesT(){
return $this->hasOne(SeriesT::className(),['id'=>'series_id']);
}
//排量
public function getDisplacementT(){
return $this->hasOne(DisplacementT::className(),['id'=>'displacement_id']);
}
public function getCarKeepInGoodItems(){
return $this->hasMany(CarKeepInGoodItems::className(),['bsdc_id'=>'id']);
}
}