A really powerful feature of CakePHP is bake – a script located at /cake/scripts/bake.php – it is similar in function to the Ruby on Rails Scaffold application – it is a command line programme that can generate outline or scaffolding code to carry out simple CRUD operations, based solely on your database structure.
I have had quite a few problems getting Bake to work reliably, but persevere because it is worth it. I have been developing on a PC running XP Pro and Apache2Triad 2.0.55
On windows there seems to be a bit of an issue with paths and in order to do any baking on an existing project you need to specify the full paths.
[I use the Command Window Here Power Toy for Win XP which makes it easy to get the command prompt to the right place.]
To create a new cake application
- Navigate to
\cake\scripts\and open the command prompt.
php bake.php -app name_of_application
- follow the onscreen instructions…
For Example: To create a new application called Flamingo:
php bake.php -app flamingo
As you can see bake asks you if its ok to create a skeleton application on the path specified.
How to bake inside an existing application
If you want to bake inside an existing application, from the Cake tutorials and articles, it appears that you should be able to just type:
php bake.php -app flamingo again, unfortunately this doesn’t work. Instead you get the following message.
What you actually need to type is something that includes the full path to your new cake application, something like:
php bake.php -app D:\apache2triad\htdocs\ctest\public_html\flamingo
If you already have a database structure you will see something like this:
If you don’t yet have a database setup you will be prompted for connection details like this: