Skip to content

Commit

Permalink
TranslateBehavior now uses original atomic option value, if set
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeram committed Oct 10, 2014
1 parent 7b44d5d commit 1dfd340
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Cake/Model/Behavior/TranslateBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ public function afterSave(Model $Model, $created, $options = array()) {
$tempData = $this->_prepareTranslations($Model, $tempData);
}
$locale = $this->_getLocale($Model);
$atomic = array();
if (isset($options['atomic'])) {
$atomic = array('atomic' => $options['atomic']);
}

foreach ($tempData as $field => $value) {
unset($conditions['content']);
Expand Down Expand Up @@ -466,10 +470,11 @@ public function afterSave(Model $Model, $created, $options = array()) {
$RuntimeModel->save(array(
$RuntimeModel->alias => array_merge(
$conditions, array('id' => $translations[$_locale])
)
),
$atomic
));
} else {
$RuntimeModel->save(array($RuntimeModel->alias => $conditions));
$RuntimeModel->save(array($RuntimeModel->alias => $conditions), $atomic);
}
}
}
Expand Down

0 comments on commit 1dfd340

Please sign in to comment.