Backporting changes form 2.2 to fix some edge cases on deep saving. Fixes #2879

This commit is contained in:
Jose Lorenzo Rodriguez 2012-05-19 21:14:23 -04:30
parent 7dbd6bc3a2
commit 16847b0d97

View file

@ -2343,6 +2343,11 @@ class Model extends Object implements CakeEventListener {
$return[$this->alias] = true;
}
$data = $this->data;
if (!empty($options['deep']) && isset($data[$this->alias])) {
$recordData = $data[$this->alias];
unset($data[$this->alias]);
$data = array_merge($data, $recordData);
}
$associations = $this->getAssociated();
foreach ($data as $association => &$values) {