Remove abstract class and use Interface+Trait

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
	src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php
	src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php
	src/Symfony/Component/DependencyInjection/ContainerAware.php
This commit is contained in:
blanchonvincent 2014-11-28 16:49:28 +01:00 committed by Tobias Schultze
parent d67feb4fc8
commit 52c50e3b1e
11 changed files with 55 additions and 22 deletions

View File

@ -11,11 +11,12 @@
namespace Symfony\Bundle\FrameworkBundle\Controller; namespace Symfony\Bundle\FrameworkBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
@ -35,8 +36,10 @@ use Doctrine\Bundle\DoctrineBundle\Registry;
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*/ */
abstract class Controller extends ContainerAware abstract class Controller implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
/** /**
* Generates a URL from the given parameters. * Generates a URL from the given parameters.
* *

View File

@ -11,7 +11,8 @@
namespace Symfony\Bundle\FrameworkBundle\Controller; namespace Symfony\Bundle\FrameworkBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@ -23,8 +24,10 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*/ */
class RedirectController extends ContainerAware class RedirectController implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
/** /**
* Redirects to another route with the given name. * Redirects to another route with the given name.
* *

View File

@ -11,7 +11,8 @@
namespace Symfony\Bundle\FrameworkBundle\Controller; namespace Symfony\Bundle\FrameworkBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
/** /**
@ -19,8 +20,10 @@ use Symfony\Component\HttpFoundation\Response;
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*/ */
class TemplateController extends ContainerAware class TemplateController implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
/** /**
* Renders a template. * Renders a template.
* *

View File

@ -11,12 +11,15 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller; namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAware;
class FragmentController extends ContainerAware class FragmentController implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
public function indexAction(Request $request) public function indexAction(Request $request)
{ {
return $this->container->get('templating')->renderResponse('fragment.html.php', array('bar' => new Bar())); return $this->container->get('templating')->renderResponse('fragment.html.php', array('bar' => new Bar()));

View File

@ -11,11 +11,14 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller; namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAware;
class ProfilerController extends ContainerAware class ProfilerController implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
public function indexAction() public function indexAction()
{ {
return new Response('Hello'); return new Response('Hello');

View File

@ -11,13 +11,16 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller; namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\DependencyInjection\ContainerAware;
class SessionController extends ContainerAware class SessionController implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
public function welcomeAction(Request $request, $name = null) public function welcomeAction(Request $request, $name = null)
{ {
$session = $request->getSession(); $session = $request->getSession();

View File

@ -11,13 +11,16 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller; namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpKernel\Controller\ControllerReference;
class SubRequestController extends ContainerAware class SubRequestController implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
public function indexAction() public function indexAction()
{ {
$handler = $this->container->get('fragment.handler'); $handler = $this->container->get('fragment.handler');

View File

@ -11,12 +11,15 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Controller; namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
class LoginController extends ContainerAware class LoginController implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
public function loginAction() public function loginAction()
{ {
$form = $this->container->get('form.factory')->create('Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType'); $form = $this->container->get('form.factory')->create('Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType');

View File

@ -11,13 +11,16 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\Controller; namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAware;
class LocalizedController extends ContainerAware class LocalizedController implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
public function loginAction(Request $request) public function loginAction(Request $request)
{ {
// get the login error if there is one // get the login error if there is one

View File

@ -11,14 +11,17 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\Controller; namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\DependencyInjection\ContainerAware;
class LoginController extends ContainerAware class LoginController implements ContainerAwareInterface
{ {
use ContainerAwareTrait;
public function loginAction(Request $request) public function loginAction(Request $request)
{ {
// get the login error if there is one // get the login error if there is one

View File

@ -11,7 +11,8 @@
namespace Symfony\Component\HttpKernel\Bundle; namespace Symfony\Component\HttpKernel\Bundle;
use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
@ -24,8 +25,10 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*/ */
abstract class Bundle extends ContainerAware implements BundleInterface abstract class Bundle implements BundleInterface
{ {
use ContainerAwareTrait;
protected $name; protected $name;
protected $extension; protected $extension;
protected $path; protected $path;