Browse Source

Fixed failing test case

Jose Lorenzo Rodriguez 14 years ago
parent
commit
dc8c731ccb

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

@@ -123,6 +123,11 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
 			$return[$model->alias] = true;
 		}
 		$data = $model->data;
+		if (!empty($options['deep']) && isset($data[$model->alias])) {
+			$recordData = $data[$model->alias];
+			unset($data[$model->alias]);
+			$data = array_merge($data, $recordData);
+		}
 
 		$associations = $model->getAssociated();
 		foreach ($data as $association => &$values) {

+ 2 - 1
lib/Cake/Test/Case/Model/ModelValidationTest.php

@@ -1564,7 +1564,8 @@ class ModelValidationTest extends BaseModelTest {
 					'comment' =>
 					'comment',
 					'published' => 'Y',
-					'user_id' => 1),
+					'user_id' => 1
+				),
 				array(
 					'id' => 3,
 					'comment' => '',