Bake table with custom name

I want to use bake with my tables , but need to give the another name for it

Ex. tb_user → Users

Unless I’m corrected here, the automated code building bake commands expect you to follow the CakePHP naming conventions. If you intend to build a cake app you’d need an exceptional reason not to - for instance you can’t change existing table structure of a decade old legacy app.

But not using the correct formats you will lose a lot of automatic abilities, like models names for a start, but then also validation rules, automatic foreign keys, other features such as automatic timestamp etc. Essentially, much of the stuff which makes us choose CakePHP in the first place.

tldr: Don’t bake; make all the models, tables, entities & templates by hand.

bake model --help

Option --table : table name to use if you have non-conventional table names.

Will this get you any further?

1 Like

Or maybe add alias afterwards.