Author: phpnut
Date: 4:32:45 PM, Saturday, October 22, 2005
Message:
Adding fixed for Ticket #91




git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1162 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2005-10-22 21:34:17 +00:00
parent 2bb31637cf
commit 9f411d1be4

View file

@ -1333,10 +1333,12 @@ class Model extends Object
*/ */
function findNeighbours ($conditions, $field, $value) function findNeighbours ($conditions, $field, $value)
{ {
list($prev) = Model::findAll($conditions." AND {$field} < '{$value}'", $field, "{$field} DESC", 1); @list($prev) = Model::findAll($conditions." AND {$field} < '{$value}'", $field, "{$field} DESC", 1);
list($next) = Model::findAll($conditions." AND {$field} > '{$value}'", $field, "{$field} ASC", 1); @list($next) = Model::findAll($conditions." AND {$field} > '{$value}'", $field, "{$field} ASC", 1);
return array('prev'=>$prev['id'], 'next'=>$next['id']); $prev = isset($prev) ? $prev: false;
$next = isset($next) ? $next: false;
return array('prev'=>$prev, 'next'=>$next);
} }
/** /**