mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +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
|
@ -1331,13 +1331,15 @@ class Model extends Object
|
|||
* @param unknown_type $value
|
||||
* @return array Array with keys "prev" and "next" that holds the id's
|
||||
*/
|
||||
function findNeighbours ($conditions, $field, $value)
|
||||
{
|
||||
list($prev) = Model::findAll($conditions." AND {$field} < '{$value}'", $field, "{$field} DESC", 1);
|
||||
list($next) = Model::findAll($conditions." AND {$field} > '{$value}'", $field, "{$field} ASC", 1);
|
||||
function findNeighbours ($conditions, $field, $value)
|
||||
{
|
||||
@list($prev) = Model::findAll($conditions." AND {$field} < '{$value}'", $field, "{$field} DESC", 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a resultset for given SQL statement.
|
||||
|
|
Loading…
Reference in a new issue