CakePHP Frustration Sometime back, I posted about my first experience with CakePHP. I installed the framework and went through the tutorial on building a simple blog application, and said “I was quite impressed”.

Now, after 3+ development weeks trying to build a real-world application, I think, maybe I was too hasty to draw that conclusion.

Baking in frustrations
During these 3 weeks, I have managed to build my own component, my own plugin, incorpoated ACL logic into the application, throughout which it has been nothing but frustration after frustration.

My biggest grouch has to be the poor documentation. I know it has been mentioned in many blogs before this, but I just have to say it again. For a framework like Cake, which reportedly make things happen “automatically”, good documentation IS the key.

In particular, I had a really frustrating time getting grips with plugins. I got errors when I tried associations between 2 models within the plugin, and I just couldn’t understand why it was so. It turned out that I had to use App::import() function within my PluginAppModel definition in order for the models to be recognized.

The other problem I had with plugin was the ambigious url between a plugin and a model. Let me explain. Let’s say I had a plugin called “seo”, in order to call the plugin, the url would be

   http://[host]/seo/[model]/[controller].

So if I wanted SEO reports, the url would be something like

   http://localhost/seo/reports/index.

So naturally, I would like a default page for http://localhost/seo/, but CakePHP will flag a missing model error if I did this.

I was trying every which way, like creating a dummy seo model and controller in /apps/models/seo.php, but the error still came up.

Eventually, after many many attempts, I ended up with defining in /config/routes.php, what CakePHP should do if it finds /seo url. Untill now, I still don’t know if this is a hack or it’s the real way of solving this ambigious url issue. In any case, since it works, I moved on.

Getting help
Help for me, came from doing Google searches for cakephp blogs and commentaries, and accessing CakePHP Google Group. A lot of answers came out of digging through these resources, but it was time consuming and doesn’t always yield any tangible results.

More frustrations ahead
It would seems that CakePHP 1.2 RC1 has been released, but be prepared for some more problems ahead as it reportedly have done away with some past conventions, and did not offer any backward compatibility. So applications written before RC1 will not work.

All this just makes me want to thrown in the towel and switch to CodeIgniter.

Definitely not for beginners
In my CakePHP first look, I pondered whether this framework was suitable for PHP beginners. I think the answer is now a definite NO. Without good documentation, beginners are just going to get lost in this framework.

Now that I’m partially through my application, I don’t really have a choice but to keep going and finish it up. But surely, after that I’m going give CodeIgniter a go and see which one will win me over.

May the best framework win!