Пример #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getActivities()
 {
     return $this->hasMany(Activity::className(), ['category_id' => 'id']);
 }
Пример #2
0
 public function getActivity()
 {
     //同样第一个参数指定关联的子表模型类名
     //
     return $this->hasOne(Activity::className(), ['id' => 'activity_id']);
 }
Пример #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getActivity0()
 {
     return $this->hasOne(Activity::className(), ['id' => 'activity']);
 }