<?php namespace common\models; use Yii; /** * This is the model class for table "project_task_category". * * @property int $id * @property string $title * @property int $project_id * * @property Project $project */ class ProjectTaskCategory extends \yii\db\ActiveRecord { /** * {@inheritdoc} */ public static function tableName() { return 'project_task_category'; } /** * {@inheritdoc} */ public function rules() { return [ [['project_id', 'title'], 'required'], [['project_id', 'title'], 'unique', 'targetAttribute' => ['project_id', 'title']], [['project_id'], 'integer'], [['title'], 'string', 'max' => 255], [['project_id'], 'exist', 'skipOnError' => true, 'targetClass' => Project::className(), 'targetAttribute' => ['project_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'title' => 'Название', 'project_id' => 'Проект', ]; } /** * @return \yii\db\ActiveQuery */ public function getProject() { return $this->hasOne(Project::className(), ['id' => 'project_id']); } }