Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use the model key if set
  • Loading branch information
AD7six committed Feb 28, 2015
1 parent 34dca57 commit 5b34706
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ORM/Behavior/TranslateBehavior.php
Expand Up @@ -105,7 +105,7 @@ public function initialize(array $config)
$this->setupFieldAssociations(
$this->_config['fields'],
$this->_config['translationTable'],
$this->_config['model'] ? $this->_config['model'] : $this->_table->alias(),
$this->_config['model'] ?: $this->_table->alias(),
$this->_config['strategy']
);
}
Expand Down Expand Up @@ -471,14 +471,14 @@ protected function _bundleTranslatedFields($entity)
}

$results = $this->_findExistingTranslations($find);
$alias = $this->_table->alias();
$model = $this->_config['model'] ?: $this->_table->alias();

foreach ($find as $i => $translation) {
if (!empty($results[$i])) {
$contents[$i]->set('id', $results[$i], ['setter' => false]);
$contents[$i]->isNew(false);
} else {
$translation['model'] = $alias;
$translation['model'] = $model;
$contents[$i]->set($translation, ['setter' => false, 'guard' => false]);
$contents[$i]->isNew(true);
}
Expand Down

0 comments on commit 5b34706

Please sign in to comment.