Permalink
Browse files

returning true on successful save

  • Loading branch information...
1 parent be602ae commit d009cf72d9a0ea4b90ec2529d867062a3c3ad347 @siran committed Apr 12, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 models/behaviors/keyvalue.php
@@ -81,6 +81,7 @@ public function getSection($Model, $foreignKey = null, $section = null) {
* @var string
*/
public function saveSection($Model, $foreignKey = null, $data = null, $section = null) {
+ $saved = true;
foreach($data as $model => $details) {
foreach($details as $key => $value) {
$newDetail = array();
@@ -98,8 +99,9 @@ public function saveSection($Model, $foreignKey = null, $data = null, $section =
$newDetail[$Model->alias][$this->settings[$Model->alias]['foreignKey']] = $foreignKey;
$newDetail[$Model->alias]['field'] = $section . '.' . $key;
$newDetail[$Model->alias]['value'] = $value;
- $Model->save($newDetail);
+ $saved = $saved && $Model->save($newDetail);
}
}
+ return $saved;
}
}

0 comments on commit d009cf7

Please sign in to comment.