Skip to content
Permalink
Browse files

Fix up the API docs for ConnectionManager::alias().

I had the parameters reversed in the last change I made.
  • Loading branch information...
markstory committed Mar 6, 2016
1 parent 5dfc55f commit bcac3359cf55964250c2401a37868cda6a5cdf2e
Showing with 13 additions and 6 deletions.
  1. +13 −6 src/Datasource/ConnectionManager.php
@@ -134,20 +134,27 @@ public static function parseDsn($config = null)
*
* You can remove aliases with ConnectionManager::dropAlias().
*
* @param string $original The connection to add an alias to.
* @param string $target The alias to create. Fetching $original will return $target when loaded with get().
* ### Usage
*
* ```
* // Make 'things' resolve to 'test_things' connection
* ConnectionManager::alias('test_things', 'things');
* ```
*
* @param string $alias The alias to add. Fetching $source will return $alias when loaded with get.
* @param string $source The connection to add an alias to.
* @return void
* @throws \Cake\Datasource\Exception\MissingDatasourceConfigException When aliasing a
* connection that does not exist.
*/
public static function alias($original, $target)
public static function alias($alias, $source)
{
if (empty(static::$_config[$target]) && empty(static::$_config[$original])) {
if (empty(static::$_config[$source]) && empty(static::$_config[$alias])) {
throw new MissingDatasourceConfigException(
sprintf('Cannot create alias of "%s" as it does not exist.', $original)
sprintf('Cannot create alias of "%s" as it does not exist.', $alias)
);
}
static::$_aliasMap[$target] = $original;
static::$_aliasMap[$source] = $alias;
}
/**

0 comments on commit bcac335

Please sign in to comment.
You can’t perform that action at this time.