Skip to content

Commit

Permalink
Inflecting slug with dash instead of underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickconroy committed Jan 14, 2015
1 parent 2b1a4ed commit cb5fa8a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ORM/Behavior/TranslateBehavior.php
Expand Up @@ -118,7 +118,7 @@ public function initialize(array $config)
public function setupFieldAssociations($fields, $table, $model, $strategy)
{
$targetTable = TableRegistry::get($table);
$targetAlias = Inflector::slug($table);
$targetAlias = Inflector::slug($table, '_');
$alias = $this->_table->alias();
$filter = $this->_config['onlyTranslated'];

Expand Down Expand Up @@ -234,7 +234,7 @@ public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
{
$locale = $entity->get('_locale') ?: $this->locale();
$table = $this->_config['translationTable'];
$targetAlias = Inflector::slug($table);
$targetAlias = Inflector::slug($table, '_');
$newOptions = [$targetAlias => ['validate' => false]];
$options['associated'] = $newOptions + $options['associated'];

Expand Down Expand Up @@ -334,7 +334,7 @@ public function findTranslations(Query $query, array $options)
{
$locales = isset($options['locales']) ? $options['locales'] : [];
$table = $this->_config['translationTable'];
$targetAlias = Inflector::slug($table);
$targetAlias = Inflector::slug($table, '_');

return $query
->contain([$targetAlias => function ($q) use ($locales, $targetAlias) {
Expand Down Expand Up @@ -482,7 +482,7 @@ protected function _bundleTranslatedFields($entity)
*/
protected function _findExistingTranslations($ruleSet)
{
$targetAlias = Inflector::slug($this->_config['translationTable']);
$targetAlias = Inflector::slug($this->_config['translationTable'], '_');
$association = $this->_table->association($targetAlias);

$query = $association->find()
Expand Down

0 comments on commit cb5fa8a

Please sign in to comment.