diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerAwareCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerAwareCommand.php index 035f5536ee8dc..94fb314cb1e71 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerAwareCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerAwareCommand.php @@ -11,39 +11,24 @@ namespace Symfony\Bundle\FrameworkBundle\Command; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use Symfony\Component\Console\DependencyInjection\ContainerAwareCommand as BaseContainerAwareCommand; /** * Command. * * @author Fabien Potencier */ -abstract class ContainerAwareCommand extends Command implements ContainerAwareInterface +abstract class ContainerAwareCommand extends BaseContainerAwareCommand { - /** - * @var ContainerInterface|null - */ - private $container; - /** * @return ContainerInterface */ protected function getContainer() { - if (null === $this->container) { + if (null === parent::getContainer()) { $this->container = $this->getApplication()->getKernel()->getContainer(); } - return $this->container; - } - - /** - * {@inheritdoc} - */ - public function setContainer(ContainerInterface $container = null) - { - $this->container = $container; + return parent::getContainer(); } } diff --git a/src/Symfony/Component/Console/CHANGELOG.md b/src/Symfony/Component/Console/CHANGELOG.md index 19d03ca3039ea..59fd08ca7515e 100644 --- a/src/Symfony/Component/Console/CHANGELOG.md +++ b/src/Symfony/Component/Console/CHANGELOG.md @@ -6,6 +6,7 @@ CHANGELOG * added a way to set a default command instead of `ListCommand` * added a way to set the process name of a command +* added ContainerAwareCommand 2.4.0 ----- diff --git a/src/Symfony/Component/Console/DependencyInjection/ContainerAwareCommand.php b/src/Symfony/Component/Console/DependencyInjection/ContainerAwareCommand.php new file mode 100644 index 0000000000000..9c79b7af6378d --- /dev/null +++ b/src/Symfony/Component/Console/DependencyInjection/ContainerAwareCommand.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\DependencyInjection; + +use Symfony\Component\Console\Command\Command; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\ContainerAwareInterface; + +/** + * Command. + * + * @author Fabien Potencier + */ +abstract class ContainerAwareCommand extends Command implements ContainerAwareInterface +{ + /** + * @var ContainerInterface|null + */ + private $container; + + /** + * @return ContainerInterface + */ + protected function getContainer() + { + return $this->container; + } + + /** + * {@inheritdoc} + */ + public function setContainer(ContainerInterface $container = null) + { + $this->container = $container; + } +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy