mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-05 11:02:40 +00:00
Fixing limit/offset bug in hasMany/hasAndBelongsToMany associations, to enable paging of related models
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3435 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
6156bae011
commit
b46c20ead4
1 changed files with 12 additions and 2 deletions
|
@ -1005,7 +1005,12 @@ class DboSource extends DataSource {
|
|||
|
||||
$limit = '';
|
||||
if (isset($assocData['limit'])) {
|
||||
$limit = $this->limit($assocData['limit'], $queryData['offset']);
|
||||
if (!isset($assocData['offset']) && isset($assocData['page'])) {
|
||||
$assocData['offset'] = ($assocData['page'] - 1) * $assocData['limit'];
|
||||
} elseif (!isset($assocData['offset'])) {
|
||||
$assocData['offset'] = null;
|
||||
}
|
||||
$limit = $this->limit($assocData['limit'], $assocData['offset']);
|
||||
}
|
||||
|
||||
$conditions = $assocData['conditions'];
|
||||
|
@ -1046,7 +1051,12 @@ class DboSource extends DataSource {
|
|||
|
||||
$limit = '';
|
||||
if (isset($assocData['limit'])) {
|
||||
$limit = $this->limit($assocData['limit'], $queryData['offset']);
|
||||
if (!isset($assocData['offset']) && isset($assocData['page'])) {
|
||||
$assocData['offset'] = ($assocData['page'] - 1) * $assocData['limit'];
|
||||
} elseif (!isset($assocData['offset'])) {
|
||||
$assocData['offset'] = null;
|
||||
}
|
||||
$limit = $this->limit($assocData['limit'], $assocData['offset']);
|
||||
}
|
||||
|
||||
$sql = 'SELECT ';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue