开发者

CakePHP database naming convention?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜