6

The database I'm working on has more than 100 tables, so I'm not going to sit here baking a model and controller for each one individually. I would like to bake all of the tables at the same time with something like the .xml files in Hibernate that tells it the limitations on fields so that I don't have to go through every column on every table, and automatically select the relationships. Is this possible?

NobleUplift
  • 5,631
  • 8
  • 45
  • 87

2 Answers2

12

To bake all of you models, use cake bake model all.

Controllers would be cake bake controller all

For Reference

Bhavin Solanki
  • 1,364
  • 11
  • 27
Bill Rollins
  • 1,736
  • 1
  • 12
  • 18
  • Thanks! I was trying `cake bake all` and it was still asking me to select my table. Is there any way to have configuration for each table in regards to fields and relationships? – NobleUplift Sep 19 '13 at 19:23
  • 1
    The bake will attempt to discover the relationships, primary keys and field validation and create them for you. I'm not sure that there is a way to manually specify those things when you are baking all models at once. If you bake them one at a time, I know you are presented with options. – Bill Rollins Sep 20 '13 at 11:49
2
.\console\cake bake model all 

In your app folder if you haven't yet set the path to cake.

Eran
  • 387,369
  • 54
  • 702
  • 768
Usman Akram
  • 101
  • 8