Skip to content

Commit

Permalink
Renamed filterUntranslated to onlyTranslated
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Dec 28, 2014
1 parent 9491ead commit aefba2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Model/Behavior/TranslateBehavior.php
Expand Up @@ -67,7 +67,7 @@ class TranslateBehavior extends Behavior {
'translationTable' => 'i18n',
'defaultLocale' => '',
'model' => '',
'filterUntranslated' => false
'onlyTranslated' => false
];

/**
Expand Down Expand Up @@ -108,7 +108,7 @@ public function initialize(array $config) {
* @return void
*/
public function setupFieldAssociations($fields, $table, $model) {
$filter = $this->_config['filterUntranslated'];
$filter = $this->_config['onlyTranslated'];
foreach ($fields as $field) {
$name = $this->_table->alias() . '_' . $field . '_translation';
$target = TableRegistry::get($name);
Expand Down Expand Up @@ -173,7 +173,7 @@ public function beforeFind(Event $event, Query $query, $options) {
$alias = $this->_table->alias();
$select = $query->clause('select');
$changeFilter = isset($options['filterByCurrentLocale']) &&
$options['filterByCurrentLocale'] !== $this->_config['filterUntranslated'];
$options['filterByCurrentLocale'] !== $this->_config['onlyTranslated'];

foreach ($fields as $field) {
$contain[$alias . '_' . $field . '_translation']['queryBuilder'] = $conditions(
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/Model/Behavior/TranslateBehaviorTest.php
Expand Up @@ -847,7 +847,7 @@ public function testChangingModelFieldValue() {
}

/**
* Tests that filterUntranslated will remove records from the result set
* Tests that onlyTranslated will remove records from the result set
* if they are not fully translated
*
* @return void
Expand All @@ -856,7 +856,7 @@ public function testFilterUntranslated() {
$table = TableRegistry::get('Articles');
$table->addBehavior('Translate', [
'fields' => ['title', 'body'],
'filterUntranslated' => true
'onlyTranslated' => true
]);
$table->locale('eng');
$results = $table->find()->where(['Articles.id' => 1])->all();
Expand All @@ -878,7 +878,7 @@ public function testFilterUntranslatedWithFinder() {
$table = TableRegistry::get('Comments');
$table->addBehavior('Translate', [
'fields' => ['comment'],
'filterUntranslated' => true
'onlyTranslated' => true
]);
$table->locale('eng');
$results = $table->find('translations')->all();
Expand Down

0 comments on commit aefba2e

Please sign in to comment.