diff --git a/src/Core/ConventionsTrait.php b/src/Core/ConventionsTrait.php index 2ad7b257a67..832e1505892 100644 --- a/src/Core/ConventionsTrait.php +++ b/src/Core/ConventionsTrait.php @@ -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'; }