Skip to content

Commit

Permalink
[FrameworkBundle] removed usage of Controller class for internal cont…
Browse files Browse the repository at this point in the history
…rollers
  • Loading branch information
fabpot committed Aug 30, 2010
1 parent b1b3ce8 commit 6b5c3d0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
Expand Up @@ -2,8 +2,8 @@

namespace Symfony\Bundle\FrameworkBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAware;

/*
* This file is part of the Symfony framework.
Expand All @@ -19,7 +19,7 @@
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class DefaultController extends Controller
class DefaultController extends ContainerAware
{
/**
* Renders the Symfony2 welcome page.
Expand All @@ -28,6 +28,6 @@ class DefaultController extends Controller
*/
public function indexAction()
{
return $this['templating']->renderResponse('FrameworkBundle:Default:index');
return $this->container->get('templating')->renderResponse('FrameworkBundle:Default:index');
}
}
Expand Up @@ -2,7 +2,7 @@

namespace Symfony\Bundle\FrameworkBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
use Symfony\Component\OutputEscaper\SafeDecorator;
Expand All @@ -21,7 +21,7 @@
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class ExceptionController extends Controller
class ExceptionController extends ContainerAware
{
/**
* Converts an Exception to a Response.
Expand All @@ -35,15 +35,15 @@ class ExceptionController extends Controller
*/
public function exceptionAction(FlattenException $exception, DebugLoggerInterface $logger = null, $format = 'html', $embedded = false)
{
$this['request']->setRequestFormat($format);
$this->container->get('request')->setRequestFormat($format);

$currentContent = '';
while (false !== $content = ob_get_clean()) {
$currentContent .= $content;
}

$response = $this->render(
'FrameworkBundle:Exception:'.($this['kernel']->isDebug() ? 'exception' : 'error'),
$response = $this->container->get('templating')->renderResponse(
'FrameworkBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error'),
array(
'exception' => new SafeDecorator($exception),
'logger' => $logger,
Expand Down
Expand Up @@ -2,7 +2,7 @@

namespace Symfony\Bundle\FrameworkBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Response;

/*
Expand All @@ -19,7 +19,7 @@
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class InternalController extends Controller
class InternalController extends ContainerAware
{
/**
* Forwards to the given controller with the given path.
Expand All @@ -31,7 +31,7 @@ class InternalController extends Controller
*/
public function indexAction($path, $controller)
{
$request = $this['request'];
$request = $this->container->get('request');
$attributes = $request->attributes;

$attributes->delete('path');
Expand All @@ -42,6 +42,6 @@ public function indexAction($path, $controller)
$attributes->add($tmp);
}

return $this['controller_resolver']->forward($controller, $attributes->all(), $request->query->all());
return $this->container->get('controller_resolver')->forward($controller, $attributes->all(), $request->query->all());
}
}
Expand Up @@ -2,7 +2,7 @@

namespace Symfony\Bundle\FrameworkBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Response;

/*
Expand All @@ -19,7 +19,7 @@
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class RedirectController extends Controller
class RedirectController extends ContainerAware
{
/**
* Redirects to another route.
Expand All @@ -38,18 +38,18 @@ class RedirectController extends Controller
public function redirectAction($route, $permanent = false)
{
if (!$route) {
$response = $this['response'];
$response = $this->container->get('response');
$response->setStatusCode(410);

return $response;
}

$code = $permanent ? 301 : 302;

$attributes = $this['request']->attributes->all();
$attributes = $this->container->get('request')->attributes->all();
unset($attributes['_route'], $attributes['route']);

$response = $this['response'];
$response = $this->container->get('response');
$response->setRedirect($this['router']->generate($route, $attributes), $code);

return $response;
Expand Down
Expand Up @@ -2,7 +2,7 @@

namespace Symfony\Bundle\FrameworkBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Response;

/*
Expand All @@ -19,7 +19,7 @@
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class TemplateController extends Controller
class TemplateController extends ContainerAware
{
/**
* Renders a template.
Expand All @@ -30,6 +30,6 @@ class TemplateController extends Controller
*/
public function templateAction($template)
{
return $this['templating']->renderResponse($template);
return $this->container->get('templating')->renderResponse($template);
}
}

0 comments on commit 6b5c3d0

Please sign in to comment.