<?php namespace common\models; use Yii; use yii\db\ActiveRecord; /** * This is the model class for table "fix_car_slave_project". * * @property integer $project_id * @property integer $price * @property integer $level * @property integer $type * * @property FixCarProject $project */ class FixCarSlaveProject extends ActiveRecord { /** * @inheritdoc */ public static function tableName() { return 'fix_car_slave_project'; } /** * @inheritdoc */ public function rules() { return [ [['project_id'], 'required'], [['project_id', 'price', 'level', 'type'], 'integer'], [['project_id', 'level'], 'unique', 'targetAttribute' => ['project_id', 'level'], 'message' => 'The combination of Project ID and Level has already been taken.'], [['project_id'], 'exist', 'skipOnError' => true, 'targetClass' => FixCarProject::className(), 'targetAttribute' => ['project_id' => 'id']], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'project_id' => 'Project ID', 'price' => 'Price', 'level' => 'Level', 'type' => 'Type', ]; } /** * @return \yii\db\ActiveQuery */ public function getProject() { return $this->hasOne(FixCarProject::className(), ['id' => 'project_id']); } }