Permalink
Browse files

Merge branch 'master' of https://github.com/bfanger/cakephp into bfan…

…ger-master
  • Loading branch information...
2 parents b4e3c8a + 9f71268 commit ab88f3e3f3ea9ece437bc4c640ef42b0a3d38290 @lorenzo lorenzo committed Oct 15, 2011
Showing with 3 additions and 11 deletions.
  1. +3 −11 cake/libs/model/behaviors/translate.php
@@ -185,27 +185,19 @@ function beforeFind(&$model, $query) {
} else {
$query['fields'][] = 'I18n__'.$field.'.content';
$query['joins'][] = array(
- 'type' => 'LEFT',
+ 'type' => 'INNER',
'alias' => 'I18n__'.$field,
'table' => $joinTable,
'conditions' => array(
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"),
'I18n__'.$field.'.model' => $model->name,
- 'I18n__'.$field.'.'.$RuntimeModel->displayField => $field
+ 'I18n__'.$field.'.'.$RuntimeModel->displayField => $field,
+ 'I18n__'.$field.'.locale' => $locale
)
);
-
- if (is_string($query['conditions'])) {
- $query['conditions'] = $db->conditions($query['conditions'], true, false, $model) . ' AND '.$db->name('I18n__'.$field.'.locale').' = \''.$locale.'\'';
- } else {
- $query['conditions'][$db->name("I18n__{$field}.locale")] = $locale;
- }
}
}
}
- if (is_array($query['fields'])) {
- $query['fields'] = array_merge($query['fields']);
- }
$this->runtime[$model->alias]['beforeFind'] = $addFields;
return $query;
}

0 comments on commit ab88f3e

Please sign in to comment.