CakePHP: find neighbors, order on 'name' or 'order'
Posted
by Brelsnok
on Stack Overflow
See other posts from Stack Overflow
or by Brelsnok
Published on 2010-03-13T15:39:49Z
Indexed on
2010/03/13
15:45 UTC
Read the original article
Hit count: 643
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')));
© Stack Overflow or respective owner