There are many cases where an additional model + table + relation would be total overhead. Like those little "status", "level", "type", "color", "category" attributes. Often those attributes are implemented as "enums" in SQL – but cake doesn’t support them…
Working with forms
The Cookbook only covers the real basics. I want to go over some common issues in a more detailed way for Cake1.3 apps. Dummy Values Dummy values for select fields are usually added in the view: /* (1) */ echo…
Cake Bake: Custom Templates
The Problem The default templates of the "baking" process are not very useful for a productive environment. They are meant to rapidly produce working code for development purposes. This is actually great for that matter. But as soon as you…
CakePHP bootstrap goodies
A list of some things quite handy for every cake app and therefore best placed in the bootstrap.php as they are not (yet) part of the cake core. # Useful when putting a string together in PHP define('LF', PHP_EOL); define('NL',…
Validating multiple models at once
There are forms where you want to add/edit not only fields of the current model, but also of a related one (usually hasMany or belongsTo). Example: User and Post $this->Post->set($this->data); $this->Post->User->set($this->data); $val1 = $this->Post->validates(); $val2 = $this->Post->User->validates(); if ($val1 &&…
CakePHP and Subversion
A Quick How-To about properly setting up a svn for your cake app. First of all, we need to drop a "trunk" folder into our svn: /trunk inside this trunk, we now add /app (actual app) /vendors (global vendors) /cake…