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.5 KiB
65 lines
1.5 KiB
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
|
|
/**
|
|
* This is the model class for table "fix_car_scale".
|
|
*
|
|
* @property integer $id
|
|
* @property integer $category_id
|
|
* @property integer $scale
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
*
|
|
* @property FixCarCategory $category
|
|
*/
|
|
class FixCarScale extends \common\models\Base
|
|
{
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'fix_car_scale';
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['category_id', 'scale','pid'], 'integer'],
|
|
[['created_at', 'updated_at'], 'safe'],
|
|
[['category_id'], 'unique','message'=>'每个配件只能对应一个比例!'],
|
|
[['category_id'], 'exist', 'skipOnError' => true, 'targetClass' => FixCarCategory::className(), 'targetAttribute' => ['category_id' => 'id']],
|
|
[['category_id','scale'],'required']
|
|
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'ID',
|
|
'category_id' => '配件名',
|
|
'pid'=>'PID',
|
|
'scale' => '比例',
|
|
'created_at' => 'Created At',
|
|
'updated_at' => 'Updated At',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return \yii\db\ActiveQuery
|
|
*/
|
|
public function getCategory()
|
|
{
|
|
return $this->hasOne(FixCarCategory::className(), ['id' => 'category_id']);
|
|
}
|
|
}
|
|
|