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

88 lines
2.1 KiB

<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "model_t".
*
* @property integer $id
* @property string $name
* @property string $price
* @property integer $year_id
* @property integer $displacement_id
* @property integer $series_id
* @property integer $factory_id
* @property integer $brand_id
* @property string $created_at
* @property string $updated_at
*/
class ModelT extends \common\models\Base
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'model_t';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'price', 'year_id', 'displacement_id', 'series_id', 'factory_id', 'brand_id'], 'required'],
[['year_id', 'displacement_id', 'series_id', 'factory_id', 'brand_id'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
[['name'], 'string', 'max' => 100],
[['price'], 'string', 'max' => 50],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => 'Name',
'price' => 'Price',
'year_id' => 'Year ID',
'displacement_id' => 'Displacement ID',
'series_id' => 'Series ID',
'factory_id' => 'Factory ID',
'brand_id' => 'Brand ID',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
public function getBrand()
{
return $this->hasOne(Brand2T::className(),['id'=>'brand_id']);
}
public function getFactory()
{
return $this->hasOne(FactoryT::className(),['id'=>'factory_id']);
}
public function getSeries()
{
return $this->hasOne(Series2T::className(),['id'=>'series_id']);
}
public function getDisplacement()
{
return $this->hasOne(DisplacementT::className(),['id'=>'displacement_id']);
}
public function getYear()
{
return $this->hasOne(YearT::className(),['id'=>'year_id']);
}
}