SoHo
SoHo

Reputation: 699

CakePHP 1.2 to 1.3 - converting findAll

I'm converting CakePHP 1.2 site to 1.3 and running in a few problems. Since Model::findAll has been removed in 1.3 how do I go about converting this piece of code?

$pages = $this->Page->findAll("category like '{$page['Page']['category']}'",null,'sort_order');

Upvotes: 1

Views: 531

Answers (2)

mark
mark

Reputation: 21743

it should be more like

$pages = $this->Page->find('all', array(
    'conditions' => array('category LIKE' => $page['Page']['category']), 
    'order'=>array(...), 
    'fields'=>array(...)
));

Upvotes: 2

Flak
Flak

Reputation: 2670

I think it goes something like this.

$pages = $this->Page->find('all', array('conditions' => array('category like ' => '{$page['Page']['category']})));

Upvotes: -1

Related Questions