Skip to content

Commit

Permalink
Assuming that if a dot is present in a table name, that the right sid…
Browse files Browse the repository at this point in the history
…e is the real name
  • Loading branch information
Patrick Conroy committed May 22, 2015
1 parent f7fac88 commit 317f368
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Core/ConventionsTrait.php
Expand Up @@ -48,12 +48,17 @@ protected function _entityName($name)

/**
* Creates the proper underscored model key for associations
* If the input contains a dot, assume that the right side is the real table name.
*
* @param string $name Model class name
* @return string Singular model key
*/
protected function _modelKey($name)
{
$model = explode('.', $name);
if (isset($model[1])) {
$name = $model[1];
}
return Inflector::underscore(Inflector::singularize($name)) . '_id';
}

Expand Down

0 comments on commit 317f368

Please sign in to comment.