Commit 65427440 authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлена модель для таблицы с уроками

parent 48207a05
<?php
namespace common\modules\analyticsSchool\models;
use Yii;
/**
* This is the model class for table "analytics_school_lessons".
*
* @property integer $id
* @property integer $course_id
* @property string $name
* @property string $video_link
* @property string $content
*
* @property AnalyticsSchoolCourse $course
*/
class AnalyticsSchoolLessons extends \common\components\ActiveRecordModel
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'analytics_school_lessons';
}
/**
* @return string
*/
public function name(){
return 'Уроки';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['course_id', 'name', 'content'], 'required'],
[['course_id'], 'integer'],
[['video_link', 'content'], 'string'],
[['name'], 'string', 'max' => 255],
[['course_id'], 'exist', 'skipOnError' => true, 'targetClass' => AnalyticsSchoolCourse::className(), 'targetAttribute' => ['course_id' => 'id']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'course_id' => 'Course ID',
'name' => 'Name',
'video_link' => 'Video Link',
'content' => 'Content',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCourse() {
return $this->hasOne(AnalyticsSchoolCourse::className(), ['id' => 'course_id']);
}
/**
* @return array
*/
public function behaviors(){
return [];
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment