Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Inflecting the prefix key in Inflectedroute
  • Loading branch information
lorenzo committed Jun 10, 2014
1 parent 802e6f8 commit e30846b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Routing/Filter/ControllerFactoryFilter.php
Expand Up @@ -65,7 +65,7 @@ protected function _getController($request, $response) {
$controller = $request->params['controller'];
}
if (!empty($request->params['prefix'])) {
$namespace .= '/' . ucfirst($request->params['prefix']);
$namespace .= '/' . $request->params['prefix'];
}
$className = false;
if ($pluginPath . $controller) {
Expand Down
10 changes: 8 additions & 2 deletions src/Routing/Route/InflectedRoute.php
Expand Up @@ -24,7 +24,7 @@
class InflectedRoute extends Route {

/**
* Parses a string URL into an array. If it mathes, it will convert the controller and
* Parses a string URL into an array. If it mathes, it will convert the prefix, controller and
* plugin keys to their camelized form
*
* @param string $url The URL to parse
Expand All @@ -41,11 +41,14 @@ public function parse($url) {
if (!empty($params['plugin'])) {
$params['plugin'] = Inflector::camelize($params['plugin']);
}
if (!empty($params['prefix'])) {
$params['prefix'] = Inflector::camelize($params['prefix']);
}
return $params;
}

/**
* Underscores the controller and plugin params before passing them on to the
* Underscores the prefix, controller and plugin params before passing them on to the
* parent class
*
* @param array $url Array of parameters to convert to a string.
Expand All @@ -61,6 +64,9 @@ public function match(array $url, array $context = array()) {
if (!empty($url['plugin'])) {
$url['plugin'] = Inflector::underscore($url['plugin']);
}
if (!empty($url['prefix'])) {
$url['prefix'] = Inflector::underscore($url['prefix']);
}
return parent::match($url, $context);
}

Expand Down

0 comments on commit e30846b

Please sign in to comment.