Skip to content

Commit

Permalink
Split the locator class name getting in a separate method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Nov 19, 2015
1 parent bfb23b9 commit 8a6606b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/ORM/Locator/TableLocator.php
Expand Up @@ -146,10 +146,7 @@ public function get($alias, array $options = [])
$options += $this->_config[$alias];
}

if (empty($options['className'])) {
$options['className'] = Inflector::camelize($alias);
}
$className = App::className($options['className'], 'Model/Table', 'Table');
$className = $this->_getClassName($alias, $options);
if ($className) {
$options['className'] = $className;
} else {
Expand All @@ -175,6 +172,20 @@ public function get($alias, array $options = [])
return $this->_instances[$alias];
}

/**
* Gets the table class name.
*
* @param string $alias The alias name you want to get.
* @param array $options Table options array.
* @return string
*/
protected function _getClassName($alias, array $options = []) {
if (empty($options['className'])) {
$options['className'] = Inflector::camelize($alias);
}
return App::className($options['className'], 'Model/Table', 'Table');
}

/**
* Wrapper for creating table instances
*
Expand Down

0 comments on commit 8a6606b

Please sign in to comment.