Skip to content

Commit

Permalink
Relaxed HABTM convention. Changed example.
Browse files Browse the repository at this point in the history
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: cakephp/bake#204 (comment)
  • Loading branch information
ionas committed Dec 30, 2015
1 parent a6b9f07 commit f12adc0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions en/getting-started/cakephp-conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f12adc0

Please sign in to comment.