Browse Source

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

Jose Lorenzo Rodriguez 14 years ago
parent
commit
16847b0d97
1 changed files with 5 additions and 0 deletions
  1. 5 0
      lib/Cake/Model/Model.php

+ 5 - 0
lib/Cake/Model/Model.php

@@ -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) {