mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-06-01 20:33:33 +00:00
Fix different format of $results in afterFind
Refs #2529 As of this commit, we can get consistent format of $resutls in afterFind. And we can keep backward compatibility if Model::$useConsistentAfterFind is set to false.
This commit is contained in:
parent
c227c14bf2
commit
c246695518
4 changed files with 96 additions and 3 deletions
lib/Cake/Model/Datasource
|
@ -1399,10 +1399,15 @@ class DboSource extends DataSource {
|
|||
$this->_mergeAssociation($row, $merge, $association, $type);
|
||||
}
|
||||
} else {
|
||||
if (!$prefetched && $LinkModel->useConsistentAfterFind) {
|
||||
if ($queryData['callbacks'] === true || $queryData['callbacks'] === 'after') {
|
||||
$this->_filterResultsInclusive($assocResultSet, $Model, array($association));
|
||||
}
|
||||
}
|
||||
$this->_mergeAssociation($row, $assocResultSet, $association, $type, $selfJoin);
|
||||
}
|
||||
|
||||
if ($type !== 'hasAndBelongsToMany' && isset($row[$association]) && !$prefetched) {
|
||||
if ($type !== 'hasAndBelongsToMany' && isset($row[$association]) && !$prefetched && !$LinkModel->useConsistentAfterFind) {
|
||||
$row[$association] = $LinkModel->afterFind($row[$association], false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue