Welcome to the Cookbook

loading...

11.1.4 Model::generateList()

The generateList() method of has been changed to find('list'). You can simplify your conversion by placing the following in /app/app_model.php.

function generateList ($cond=null,$order=null,$limit=null,$key=null,$val=null) {
    return $this->find("list",array(
        'conditions' => $cond, 
        'order' => $order,
        'limit' => $limit,
        'fields' => array(str_replace('{n}.','',$key), str_replace('{n}.','',$val))
    ));
}
  1. function generateList ($cond=null,$order=null,$limit=null,$key=null,$val=null) {
  2. return $this->find("list",array(
  3. 'conditions' => $cond,
  4. 'order' => $order,
  5. 'limit' => $limit,
  6. 'fields' => array(str_replace('{n}.','',$key), str_replace('{n}.','',$val))
  7. ));
  8. }