mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Stop calling limit() twice on the same data.
DboSource::limit() now follows its documented input types, passing an already formatted LIMIT string will result in LIMIT 0. Remove useless array merging as well.
This commit is contained in:
parent
2096d3f632
commit
7b0af659a9
1 changed files with 2 additions and 2 deletions
|
@ -1529,7 +1529,6 @@ class DboSource extends DataSource {
|
|||
if (empty($assocData['offset']) && !empty($assocData['page'])) {
|
||||
$assocData['offset'] = ($assocData['page'] - 1) * $assocData['limit'];
|
||||
}
|
||||
$assocData['limit'] = $this->limit($assocData['limit'], $assocData['offset']);
|
||||
|
||||
switch ($type) {
|
||||
case 'hasOne':
|
||||
|
@ -1555,7 +1554,6 @@ class DboSource extends DataSource {
|
|||
'alias' => $association,
|
||||
'group' => null
|
||||
));
|
||||
$query += array('order' => $assocData['order'], 'limit' => $assocData['limit']);
|
||||
} else {
|
||||
$join = array(
|
||||
'table' => $linkModel,
|
||||
|
@ -1586,6 +1584,7 @@ class DboSource extends DataSource {
|
|||
'alias' => $association,
|
||||
'order' => $assocData['order'],
|
||||
'limit' => $assocData['limit'],
|
||||
'offset' => $assocData['offset'],
|
||||
'group' => null
|
||||
);
|
||||
break;
|
||||
|
@ -1613,6 +1612,7 @@ class DboSource extends DataSource {
|
|||
$query = array(
|
||||
'conditions' => $assocData['conditions'],
|
||||
'limit' => $assocData['limit'],
|
||||
'offset' => $assocData['offset'],
|
||||
'table' => $this->fullTableName($linkModel),
|
||||
'alias' => $association,
|
||||
'fields' => array_merge($this->fields($linkModel, $association, $assocData['fields']), $joinFields),
|
||||
|
|
Loading…
Reference in a new issue