Ejemplo n.º 1
0
 /**
  * 返回章节的数组
  * @return array|\yii\db\ActiveRecord[]
  */
 public function getChapters()
 {
     return $this->hasMany(Chapter::className(), ['course_id' => 'id'])->orderBy(['sort_order' => SORT_ASC]);
 }
Ejemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getChapter()
 {
     return $this->hasOne(Chapter::className(), ['id' => 'chapter_id']);
 }