Skip to content
Permalink
Browse files

Ugly hack to fix saveAll deep and beforeValidate callbacks changing m…

…odel data
  • Loading branch information...
lorenzo committed May 10, 2012
1 parent 1481f82 commit 82e87791f6d01ee59389a7bdb1e8e3ee92aa1630
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/Cake/Model/Model.php
@@ -2324,7 +2324,16 @@ public function validateAssociated(&$data, $options = array()) {
} else {
$return[$this->alias] = true;
}
$data[$this->alias] = $this->data[$this->alias];
if (empty($options['deep'])) {
$data[$this->alias] = $this->data[$this->alias];
} else {
$modelData = $this->data;
$recordData = $modelData[$this->alias];
unset($modelData[$this->alias]);
$data = $modelData + array_merge($data, $recordData);
}
$associations = $this->getAssociated();
foreach ($data as $association => &$values) {
$validates = true;

0 comments on commit 82e8779

Please sign in to comment.
You can’t perform that action at this time.