Home

March 20th, 2008

12:15 am
generateList() disappeared in CakePHP 1.2

After a couple of days of messing about with CakePHP, I have decided to move on to 1.2 (beta). There are a lot more functions in the newer version than the old. The problem is that there's even LESS documentation.

The Model::generateList() disappeared in CakePHP 1.2.x :( This was a handy function to generate key/value pairs from tables for stuff like a drop down, or radio button. The following two calls should work:
var $uses = array('Model1', 'Status');
...
$tmpVals = $this->Status->findAll(array('context' => '= users'));
$tmpVals = Set::combine($tmpVals, '{n}.Status.id', '{n}.Status.name');
This is assuming that your Status table contains the fields 'id', and 'name' which would be the <.. value= ..> and the plain text description, respectively.

12:25 am
Set::combine

More on Set::combine (as close to documentation as it gets).
http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/

03:05 pm
Left of the Dial: Dispatches from the '80s Underground

So I had actually bought this a while ago, but never really got past the first couple of tracks. I don't know why, but now particularly, it's absolutely AMAZING. Maybe it's just my frame of mine.