Merge pull request #11825 from cakephp/dereuromark-patch-2

Fix notice when passing false.
This commit is contained in:
Mark Story 2018-03-14 17:32:59 +00:00 committed by GitHub
commit d63c847b61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1566,6 +1566,7 @@ class DboSource extends DataSource {
// Make one pass through children and collect by parent key // Make one pass through children and collect by parent key
// Make second pass through parents and associate children // Make second pass through parents and associate children
$mergedByFK = array(); $mergedByFK = array();
if (is_array($assocResultSet)) {
foreach ($assocResultSet as $data) { foreach ($assocResultSet as $data) {
$fk = $data[$association][$foreignKey]; $fk = $data[$association][$foreignKey];
if (! array_key_exists($fk, $mergedByFK)) { if (! array_key_exists($fk, $mergedByFK)) {
@ -1585,6 +1586,7 @@ class DboSource extends DataSource {
$mergedByFK[$fk][] = $data[$association]; $mergedByFK[$fk][] = $data[$association];
} }
} }
}
foreach ($resultSet as &$result) { foreach ($resultSet as &$result) {
if (!isset($result[$modelAlias])) { if (!isset($result[$modelAlias])) {