当前模型类为活动表id,关联评论表的type_id,条件是评论表的type要等于2
public function getComment(){
return $this->hasMany(Comment::className(),['type_id'=>'id'])->onCondition([Comment::tableName().'.type'=>2]);
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2021-10-31
猜你喜欢
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-13
  • 2021-05-28
相关资源
相似解决方案