我已经设法将我的 2 个表clients和risk_codes彼此连接在一起,其中clients.risk_code_id有一个外键for risk_codes.id。
在我的客户端编辑视图中,我使用 HTML Helper 输出了一个表单。例如添加一个输入来编辑clients.name我会使用echo $this->Form->input('name');
鉴于这risk_codes是一个单独的表/模型,我将如何输出选项为risk_codes.name且值为的选择下拉列表risk_codes.id?
这些表是这样链接的:
Client belongsTo RiskCode
RiskCode hasMany Client