guild/common/models/QuestionType.php

67 lines
1.2 KiB
PHP
Raw Normal View History

2021-10-22 17:02:28 +03:00
<?php
namespace common\models;
use yii\behaviors\SluggableBehavior;
2021-11-08 12:41:39 +03:00
use yii\db\ActiveRecord;
2021-10-22 17:02:28 +03:00
/**
* This is the model class for table "question_type".
*
* @property int $id
* @property string $question_type
* @property string $slug
*
* @property Question[] $questions
*/
2021-11-08 12:41:39 +03:00
class QuestionType extends ActiveRecord
2021-10-22 17:02:28 +03:00
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'question_type';
}
public function behaviors()
{
return [
[
'class' => SluggableBehavior::class,
'attribute' => 'question_type',
]
];
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['question_type'], 'string', 'max' => 255],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'question_type' => 'Тип вопроса',
'slug' => 'Slug',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getQuestions()
{
return $this->hasMany(Question::className(), ['question_type_id' => 'id']);
}
}