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/StoreRoom.php.bak1

105 lines
2.7 KiB

<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "store_room".
*
* @property integer $id
* @property string $name
* @property integer $number
* @property integer $brand_id
* @property integer $series_id
* @property integer $displacement_id
* @property integer $category_id
* @property integer $category_1
* @property string $car_year
* @property string $created_at
* @property string $updated_at
*/
class StoreRoom extends \common\models\Base
{
public function scenarios()
{
return [
'default'=>['number','brand_id','series_id','displacement_id','category_id','category_1','year_id','scale_id','producing_area','price'],
'put_out_store'=>['number']
];
}
/**
* @inheritdoc
*/
public static function tableName()
{
return 'store_room';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['number', 'brand_id', 'series_id', 'displacement_id','year_id', 'category_id', 'category_1','scale_id'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
[['price'],'number'],
[['producing_area'], 'string', 'max' => 100],
[['brand_id','series_id','displacement_id','year_id','number','category_1','name','producing_area','price'],'required','on'=>'default']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'scale_id' => 'Scale ID',
'number' => '数量',
'brand_id' => '品牌',
'series_id' => '系列',
'displacement_id' => '排量',
'category_id' => 'Category ID',
'category_1' => '分类',
'year_id' => '年份',
'price'=>'进价',
'producing_area'=> '产地',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
/**
* @品牌
*/
public function getBrand(){
return $this->hasOne(BrandT::className(),['id'=>'brand_id']);
}
/**
* @系列
*/
public function getSeries(){
return $this->hasOne(SeriesT::className(),['id'=>'series_id']);
}
/**
* @排量
*/
public function getDisplacement(){
return $this->hasOne(DisplacementT::className(),['id'=>'displacement_id']);
}
/**
* @年份
*/
public function getYearT(){
return $this->hasOne(YearT::className(),['id'=>'year_id']);
}
/**
* @ 名字
*/
public function getItemScale(){
return $this->hasOne(FixCarCategory::className(),['id'=>'scale_id']);
}
}