我有 2 张桌子,post和comment. 在 Laravel 中,我可以comment_post通过在模型中定义关系来隐式创建数据透视表。我如何在 Yii2 中做同样的事情?
桌柱:
id -- PK
text
Run Code Online (Sandbox Code Playgroud)
表评论:
id -- PK
text
user_id
Run Code Online (Sandbox Code Playgroud)
表comment_post:
id -- PK
post_id -- foreign key references ID on post table
comment_id -- foreign key references ID on comment table
Run Code Online (Sandbox Code Playgroud)