Overview
In this tutorial I’ll show you in 25 minutes how to generate some basic CRUD functionality into your CakePHP website without writing a single line of code! This can be done by using the console which you get for free with CakePHP.
This is a great way to get up’n’running in minutes and start from what CakePHP has generated for you.
In this tutorial I’ll be covering
- Downloading CakePHP
- Creating database tables
- Generate Models based on database tables, controllers and views
- Setup the $PATH environment variable so you can call the cake command from everywhere on your system
Possible issue
If you get the following error while trying to bake your models
[crayon lang=”php” title=”Possible error message”]
PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /Users/Frederik/PROJECTS/tutorials/php/cakeBake/lib/Cake/Model/Datasource/Database/Mysql.php, line 149
[/crayon]
you have to symlink your mysql socket file in Terminal. Do the following in Terminal:
[crayon lang=”php” title=”Add symlink”]
cd ~ // go to home directory
sudo mkdir /var/mysql // create a directory in var/mysql,
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock // create a symbolic link between your mysql.sock file in your MAMP directory and the one in var/mysql
[/crayon]
Let me know if you enjoyed it!
The tutorial
[ylwm_vimeo width=”610″ height=”342″]47293068[/ylwm_vimeo]