As popular and awesome as CakePHP is, there just isn’t enough documentation on it. I guarantee many hours or days learning to wrangle with it.
Using Eclipse to maintain CakePHP projects is even worse. Precisely one tutorial exists, and it just doesn’t, um, cut the cake. It left me more confused than before I started.
After spending an hour on IRC’s #cakephp, one very patient user guided me through the process. By the end of the session, all I really needed was a visualisation of the setup. He took a desktop snap and sent it to me. Bam! Eclipse and CakePHP were together in five minutes.
In the interest of aiding visual learners out there and filling in the gaps left by the CakePHP/Eclipse tutorial, I pass this image on to you.
As the tutorial mentions, you will be creating two separate Eclipse projects: one for Cake core, and another for your project. Select everything inside /cake/cake and copy it into the core project; using /cake/cake as an include path works too. ((My biggest criticism yet of CakePHP: the developers didn’t spend any time thinking of the repercussions from naming a directory and its child the same thing.))
In your other project, use the core as an included project (right-click or whatever on Include Paths > Configure Include Path). Finally, select everything inside /cake/app and copy it into your project (again, including /cake/app is also valid).
That should work. If it doesn’t, feel free to comment below, though I’m likely to be of insufficient help. Otherwise, hum to yourself as you happily code away:
This was a triumph
I’m making a note here: ‘HUGE SUCCESS’…
Responses to comments after the jump…
Update: ryanb correctly notes that my criticism of poor directory naming choices was incorrect. I had unwisely named the directory containing the cake core the same thing, cake, creating the mind-numbing cake/cake. I managed to correct this a few weeks ago, but regretfully never edited out the misstatement from the blog. I sincerely apologise.
On the reverse side, ryanb does me injustice for blaming the developers for making a lousy tutorial. Never, in any step in the blogging process, did I link official CakePHP development with the tutorial. I did say the documentation is weak, and I did cite the tutorial, but I didn’t say the tutorial and the documentation were the same thing. The aesthetics of the official documentation and the roughness of the tutorial should be enough to differentiate the two. Admittedly a clarifying statement would have helped, but it never occured to me.
Tags: games, php, programming

I don’t get code hinting for associated models! …. you do ?
“My biggest criticism yet of CakePHP: the developers didn’t spend any time thinking of the repercussions from naming a directory and its child the same thing.”
Umm…no. Sorry. Your logic is affected by your flaming. There are not two “cake” folders in the download. There is a cake_ folder with a child folder called cake. Any non-absent-minded person would realize that the parent folder within the zip file represents the entire CakePHP PROJECT (aka distribution) and that the APP and CAKE directories are two top level directories.
Now comes the fun when you set up XAMPP and Eclipse. Rather than storing your projects (APP folders) and the cake core in the root of XAMPP, you are instructed to create a nice little subdirectory called “cake” (or “cakeprojects” or “stuff”; that would ease your apparent confusion). Whatever you call it does not matter. Now you can have a cake\cake or cakeprojects\cake or stuff\cake.
Rather than blaming the “developers,” you should realize that the “developers” did not write that tutorial. A developer (NB: singular), community member, or cake guru wrote it.
@Anonymous: You won’t get code hinting for associated models without a little hacking. Check out comment 11 on the bakery article referenced above.