adding forgotten files
This commit is contained in:
66
common/models/QuestionType.php
Normal file
66
common/models/QuestionType.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\behaviors\SluggableBehavior;
|
||||
|
||||
/**
|
||||
* This is the model class for table "question_type".
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $question_type
|
||||
* @property string $slug
|
||||
*
|
||||
* @property Question[] $questions
|
||||
*/
|
||||
class QuestionType extends \yii\db\ActiveRecord
|
||||
{
|
||||
/**
|
||||
* {@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']);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user