mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
[1161]
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:
parent
2bb31637cf
commit
9f411d1be4
1 changed files with 9 additions and 7 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue