开发者

CakePHP database naming convention?

开发者 https://www.devze.com 2023-03-18 16:39 出处:网络
I have two 开发者_如何学Ctables: doctypes_visas users_visas Now I need I third one that joins the two above.

I have two 开发者_如何学Ctables: doctypes_visas users_visas

Now I need I third one that joins the two above.

According to CakePHP naming conventions, what will be the suitable name for this table doctypes_visas_users_visas?

Thanks.


As per the CakePHP documentation, if the association is a hasAndBelongsToMany type relationship, you are correct. The name's name should indeed by doctypes_visas_users_visas.

From the documentation:

This new join table's name needs to include the names of both models involved, in alphabetical order, and separated with an underscore ( _ ). The contents of the table should be two fields, each foreign keys (which should be integers) pointing to both of the primary keys of the involved models. To avoid any issues - don't define a combined primary key for these two fields, if your application requires it you can define a unique index.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号