Reputation: 962
I want to display links of first and previous record. I use following code but it returns empty.
$neighbors = $this->names->find('neighbors', array('conditions'=>array('names.Id'=>12),'limit'=>1));
This is my working code below, which returns data for the current record
$this->set("names", $this->names->find('all',array('conditions'=>array('names.Id'=>$id))));
How can I achieve this. Please help me.
Thanks
Upvotes: 4
Views: 2641
Reputation: 595
As docs says http://book.cakephp.org/2.0/en/models/retrieving-your-data.html, you need to do like this
$neighbors = $this->names->find(
'neighbors',
array('field' => 'Id', 'value' => 12)
);
Upvotes: 4