Skip to content

Commit

Permalink
Use + instead of array_merge.
Browse files Browse the repository at this point in the history
If you have numeric columns in your database, array_merge() will re-key
the array dropping the original values.

Fixes #2198
  • Loading branch information
markstory committed Oct 25, 2013
1 parent 8a90cbd commit 7624884
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Model/ModelValidator.php
Expand Up @@ -141,7 +141,7 @@ public function validateAssociated(&$data, $options = array()) {
if (!empty($options['deep']) && isset($data[$model->alias])) { if (!empty($options['deep']) && isset($data[$model->alias])) {
$recordData = $data[$model->alias]; $recordData = $data[$model->alias];
unset($data[$model->alias]); unset($data[$model->alias]);
$data = array_merge($data, $recordData); $data += $recordData;
} }


$associations = $model->getAssociated(); $associations = $model->getAssociated();
Expand Down

0 comments on commit 7624884

Please sign in to comment.