Skip to content

Commit

Permalink
Take care of properly inflecting plugin name in route classes itself.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jan 24, 2016
1 parent 72db96b commit 351faea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/Routing/Filter/ControllerFactoryFilter.php
Expand Up @@ -68,11 +68,7 @@ protected function _getController($request, $response)
$controller = $request->params['controller'];
}
if (!empty($request->params['prefix'])) {
$prefixes = array_map(
'Cake\Utility\Inflector::camelize',
explode('/', $request->params['prefix'])
);
$namespace .= '/' . implode('/', $prefixes);
$namespace .= '/' . $request->params['prefix'];
}
if (strpos($controller, '\\') !== false || strpos($controller, '.') !== false) {
return false;
Expand Down
7 changes: 6 additions & 1 deletion src/Routing/Route/InflectedRoute.php
Expand Up @@ -50,7 +50,12 @@ public function parse($url)
$params['controller'] = Inflector::camelize($params['controller']);
}
if (!empty($params['plugin'])) {
$params['plugin'] = Inflector::camelize($params['plugin']);
if (strpos($params['plugin'], '/') === false) {
$params['plugin'] = Inflector::camelize($params['plugin']);
} else {
list($vendor, $plugin) = explode('/', $params['plugin'], 2);
$params['plugin'] = Inflector::camelize($vendor) . '/' . Inflector::camelize($plugin);
}
}
return $params;
}
Expand Down

0 comments on commit 351faea

Please sign in to comment.