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

101 lines
2.4 KiB

<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "fix_car_project".
*
* @property integer $id
* @property string $name
* @property integer $type
* @property string $created_at
* @property string $updated_at
*
* @property FixCarBeautify[] $fixCarBeautifies
* @property FixCarJidian[] $fixCarJidians
* @property FixCarMetal[] $fixCarMetals
* @property FixCarPaint[] $fixCarPaints
* @property FixCarGroup $type0
*/
class FixCarProject extends \common\models\Base
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'fix_car_project';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name'], 'required'],
[['type'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
[['name'], 'string', 'max' => 100],
[['name', 'type'], 'unique', 'targetAttribute' => ['name', 'type'], 'message' => '项目名不可重复!.'],
[['type'], 'exist', 'skipOnError' => true, 'targetClass' => FixCarGroup::className(), 'targetAttribute' => ['type' => 'id']],
[['name','type'],'required','on'=>'default']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => '项目名',
'type' => 'Type',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getFixCarBeautifies()
{
return $this->hasMany(FixCarBeautify::className(), ['project_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getFixCarJidians()
{
return $this->hasMany(FixCarJidian::className(), ['project_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getFixCarMetals()
{
return $this->hasMany(FixCarMetal::className(), ['project_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getFixCarPaints()
{
return $this->hasMany(FixCarPaint::className(), ['project_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getType0()
{
return $this->hasOne(FixCarGroup::className(), ['id' => 'type']);
}
}