CakePHP 中几个 table 的公共列

Common columns to several table in CakePHP

我想知道是否有一种聪明的方法可以在 CakePhP 中为不同的 table 设置多个公共列。我可以使用与这些 table 有关系的公共 table,但是是否存在我可以拥有的行为或类似机制:

用户 顾客 CommonPersonalFields

并且在第三个 table 中有一些公共字段,由 cake 自动获取。通过这种方式,您还可以拥有这些字段的共同视图,包括在其他 table 视图中。

这是在 CakePHP 中用 Model Associations 完成的。在这种情况下,您的模型将是 UserCustomerPersonalData,并且您的关联是 User hasOne PersonalDataCustomer hasOne PersonalData,如果您希望关联从两个方向链接,PersonalData belongsTo UserPersonalData belongsTo Customer.