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

92 lines
2.0 KiB

5 years ago
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "fix_car_category".
*
* @property integer $id
* @property string $name
* @property integer $pid
* @property integer $scale
* @property string $created_at
* @property string $updated_at
*
* @property FixCarProject[] $fixCarProjects
* @property FixCarScale $fixCarScale
* @property MiddleGroupCategory[] $middleGroupCategories
* @property StoreRoom[] $storeRooms
*/
class FixCarCategory extends \common\models\Base
{
public function scenarios()
{
return ['insert'=>['pid','name','scale']];
}
/**
* @inheritdoc
*/
public static function tableName()
{
return 'fix_car_category';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['pid', 'scale'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
[['name'], 'string', 'max' => 100],
[['pid','name','scale'],'required','on'=>'insert'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => 'Name',
'pid' => 'Pid',
'scale' => 'Scale',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getFixCarProjects()
{
return $this->hasMany(FixCarProject::className(), ['category_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getMiddleGroupCategories()
{
return $this->hasMany(MiddleGroupCategory::className(), ['fix_car_category_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getStoreRooms()
{
return $this->hasMany(StoreRoom::className(), ['category_id' => 'id']);
}
public function getCategory($condition){
return self::find()->where($condition)->all();
}
}