Permalink
Browse files

Re-format long lines.

  • Loading branch information...
1 parent 0282194 commit d6e2b6f83e0080a52ee3472c5f99c5be22386493 @markstory markstory committed Sep 15, 2012
Showing with 30 additions and 7 deletions.
  1. +30 −7 lib/Cake/Model/Behavior/TranslateBehavior.php
View
37 lib/Cake/Model/Behavior/TranslateBehavior.php
@@ -139,15 +139,22 @@ public function beforeFind(Model $Model, $query) {
return $query;
}
- $fields = array_merge($this->settings[$Model->alias], $this->runtime[$Model->alias]['fields']);
+ $fields = array_merge(
+ $this->settings[$Model->alias],
+ $this->runtime[$Model->alias]['fields']
+ );
$addFields = array();
if (empty($query['fields'])) {
$addFields = $fields;
} elseif (is_array($query['fields'])) {
foreach ($fields as $key => $value) {
$field = (is_numeric($key)) ? $value : $key;
- if (in_array($Model->escapeField('*'), $query['fields']) || in_array($Model->alias . '.' . $field, $query['fields']) || in_array($field, $query['fields'])) {
+ if (
+ in_array($Model->escapeField('*'), $query['fields']) ||
+ in_array($Model->alias . '.' . $field, $query['fields']) ||
+ in_array($field, $query['fields'])
+ ) {
$addFields[] = $field;
}
}
@@ -395,7 +402,10 @@ public function afterSave(Model $Model, $created) {
$conditions = array('model' => $Model->alias, 'foreign_key' => $Model->id);
$RuntimeModel = $this->translateModel($Model);
- $fields = array_merge($this->settings[$Model->alias], $this->runtime[$Model->alias]['fields']);
+ $fields = array_merge(
+ $this->settings[$Model->alias],
+ $this->runtime[$Model->alias]['fields']
+ );
if ($created) {
// set each field value to an empty string
foreach ($fields as $key => $field) {
@@ -421,13 +431,20 @@ public function afterSave(Model $Model, $created) {
$value = array($locale => $value);
}
}
- $translations = $RuntimeModel->find('list', array('conditions' => $conditions, 'fields' => array($RuntimeModel->alias . '.locale', $RuntimeModel->alias . '.id')));
+ $translations = $RuntimeModel->find('list', array(
+ 'conditions' => $conditions,
+ 'fields' => array($RuntimeModel->alias . '.locale', $RuntimeModel->alias . '.id')
+ ));
foreach ($value as $_locale => $_value) {
$RuntimeModel->create();
$conditions['locale'] = $_locale;
$conditions['content'] = $_value;
if (array_key_exists($_locale, $translations)) {
- $RuntimeModel->save(array($RuntimeModel->alias => array_merge($conditions, array('id' => $translations[$_locale]))));
+ $RuntimeModel->save(array(
+ $RuntimeModel->alias => array_merge(
+ $conditions, array('id' => $translations[$_locale])
+ )
+ ));
} else {
$RuntimeModel->save(array($RuntimeModel->alias => $conditions));
}
@@ -443,7 +460,10 @@ public function afterSave(Model $Model, $created) {
*/
public function afterDelete(Model $Model) {
$RuntimeModel = $this->translateModel($Model);
- $conditions = array('model' => $Model->alias, 'foreign_key' => $Model->id);
+ $conditions = array(
+ 'model' => $Model->alias,
+ 'foreign_key' => $Model->id
+ );
$RuntimeModel->deleteAll($conditions);
}
@@ -511,7 +531,10 @@ public function bindTranslation(Model $Model, $fields, $reset = true) {
}
$associations = array();
$RuntimeModel = $this->translateModel($Model);
- $default = array('className' => $RuntimeModel->alias, 'foreignKey' => 'foreign_key');
+ $default = array(
+ 'className' => $RuntimeModel->alias,
+ 'foreignKey' => 'foreign_key'
+ );
foreach ($fields as $key => $value) {
if (is_numeric($key)) {

0 comments on commit d6e2b6f

Please sign in to comment.