CakePHP: find neighbors, order on 'name' or 'order'
- by Brelsnok
Hi,
I have a list of ordered items, ordered according to the int field order.
I'm creating a gallery in CakePHP 1.2 that has a prev and next button and those should link to the previous and next item according to their ordering, not according to their id.
In order to get this result I've included the 'order' parameter to the find function, and populated it with 'Item.order'=>'DESC'. Still the result is an id ordered list.
My question is: what do I do wrong?
My controller:
$this->Item->id = 16;
$neighbours = $this->Item->find('neighbors', array('order'=>array('Item.order'=>'DESC'), 'fields'=>array('id','name')));