[FrameworkBundle] fixed TemplateRefence::getPath() when using namespaced controllers (i.e: AcmeBlogBundle\\Controller\\Admin\\PostController)

This commit is contained in:
Hugo Hamon 2011-06-15 18:27:34 +02:00
parent e145bdf6ff
commit 2616efb03f

View File

@ -41,6 +41,12 @@ class TemplateReference extends BaseTemplateReference
public function getPath()
{
$controller = $this->get('controller');
// Fix for namespaced controllers
if (!empty($controller) && false !== strpos($controller, '\\')) {
$controller = str_replace('\\', '/', $controller);
}
$path = (empty($controller) ? '' : $controller.'/').$this->get('name').'.'.$this->get('format').'.'.$this->get('engine');
return empty($this->parameters['bundle']) ? 'views/'.$path : '@'.$this->get('bundle').'/Resources/views/'.$path;