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.
65 lines
1.3 KiB
65 lines
1.3 KiB
5 years ago
|
<?php
|
||
|
|
||
|
namespace common\models;
|
||
|
|
||
|
use Yii;
|
||
|
|
||
|
/**
|
||
|
* This is the model class for table "car_model_t".
|
||
|
*
|
||
|
* @property integer $id
|
||
|
* @property string $name
|
||
|
* @property integer $brand_id
|
||
|
* @property integer $factory_id
|
||
|
* @property string $created_at
|
||
|
* @property string $updated_at
|
||
|
*/
|
||
|
class CarModelT extends \yii\db\ActiveRecord
|
||
|
{
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public static function tableName()
|
||
|
{
|
||
|
return 'car_model_t';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public function rules()
|
||
|
{
|
||
|
return [
|
||
|
[['name', 'brand_id', 'factory_id'], 'required'],
|
||
|
[['brand_id', 'factory_id'], 'integer'],
|
||
|
[['created_at', 'updated_at'], 'safe'],
|
||
|
[['name'], 'string', 'max' => 100],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public function attributeLabels()
|
||
|
{
|
||
|
return [
|
||
|
'id' => 'ID',
|
||
|
'name' => 'Name',
|
||
|
'brand_id' => 'Brand ID',
|
||
|
'factory_id' => 'Factory 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']);
|
||
|
}
|
||
|
}
|