Home

Thu, Mar. 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.