Fix different format of $results in afterFind

Refs 

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:
chinpei215 2014-08-11 00:21:51 +09:00
parent c227c14bf2
commit c246695518
4 changed files with 96 additions and 3 deletions
lib/Cake/Model/Datasource

View file

@ -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);
}