From f12adc0d934ce544d4f54eeda1c73bec205d8ad4 Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 30 Dec 2015 20:15:24 +0100 Subject: [PATCH] Relaxed HABTM convention. Changed example. Relaxed HABTM convention by making clear which part is mandatory (must use table names, joined by an underscore, order should be alphabetically but need not be). Changed example from apples/zebras (as that makes little sense as a HABTM) to apes/zoos (as that hopefully makes more sense). Ref: https://github.com/cakephp/bake/issues/204#issuecomment-168046038 --- en/getting-started/cakephp-conventions.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/en/getting-started/cakephp-conventions.rst b/en/getting-started/cakephp-conventions.rst index 657702e29b..cf58de6086 100644 --- a/en/getting-started/cakephp-conventions.rst +++ b/en/getting-started/cakephp-conventions.rst @@ -137,9 +137,10 @@ table like category\_types whose name contains multiple words, the foreign key would be category\_type\_id. Join tables, used in hasAndBelongsToMany (HABTM) relationships -between models, should be named after the model tables they will -join, arranged in alphabetical order (apples\_zebras rather than -zebras\_apples). +between models, must be named after the model tables they will +join, e.g. users HABTM groups would be joined by groups_users, and +should be arranged in alphabetical order, e.g. apes\_zoos +is better than zoos\_apes. All tables with which CakePHP models interact (with the exception of join tables) require a singular primary key to uniquely