guild/common/models/ProjectTaskCategory.php

60 lines
1.3 KiB
PHP
Raw Normal View History

<?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 [
2023-01-25 11:50:07 +03:00
[['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']);
}
}