8000 [FrameworkBundle] Commands as a service by ro0NL · Pull Request #23624 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Commands as a service #23624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter < 10000 details-menu class="SelectMenu js-file-filter">

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed bc layers in favor of final
  • Loading branch information
ro0NL committed Aug 6, 2017
commit d0b35d0299aa850e762f33437e75c790fae7274f
12 changes: 0 additions & 12 deletions src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@
*/
class AboutCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@ public function __construct($filesystem = null)
$this->filesystem = $filesystem;
}

/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -111,8 +99,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
// BC to be removed in 4.0
if (null === $this->filesystem) {
$this->filesystem = parent::getContainer()->get('filesystem');
$baseDir = parent::getContainer()->getParameter('kernel.project_dir');
$this->filesystem = $this->getContainer()->get('filesystem');
$baseDir = $this->getContainer()->getParameter('kernel.project_dir');
}

$kernel = $this->getApplication()->getKernel();
Expand Down
18 changes: 3 additions & 15 deletions src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@ public function __construct($cacheClearer = null, Filesystem $filesystem = null)
$this->filesystem = $filesystem ?: new Filesystem();
}

/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -96,9 +84,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
// BC to be removed in 4.0
if (null === $this->cacheClearer) {
$this->cacheClearer = parent::getContainer()->get('cache_clearer');
$this->filesystem = parent::getContainer()->get('filesystem');
$realCacheDir = parent::getContainer()->getParameter('kernel.cache_dir');
$this->cacheClearer = $this->getContainer()->get('cache_clearer');
$this->filesystem = $this->getContainer()->get('filesystem');
$realCacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
}

$io = new SymfonyStyle($input, $output);
Expand Down
16 changes: 2 additions & 14 deletions src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@ public function __construct($cacheWarmer = null)
$this->cacheWarmer = $cacheWarmer;
}

/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
10000 }

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -92,8 +80,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
// BC to be removed in 4.0
if (null === $this->cacheWarmer) {
$this->cacheWarmer = parent::getContainer()->get('cache_warmer');
$cacheDir = parent::getContainer()->getParameter('kernel.cache_dir');
$this->cacheWarmer = $this->getContainer()->get('cache_warmer');
$cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
}

$io = new SymfonyStyle($input, $output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*
* @author Ryan Weaver <ryan@thatsquality.com>
*
* @final since version 3.4
* @internal since version 3.4
*/
class ContainerDebugCommand extends ContainerAwareCommand
{
Expand All @@ -37,18 +37,6 @@ class ContainerDebugCommand extends ContainerAwareCommand
*/
protected $containerBuilder;

/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@ public function __construct($dispatcher = null)
$this->dispatcher = $dispatcher;
}

/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -95,16 +83,8 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
// BC to be removed in 4.0
if (__CLASS__ !== get_class($this)) {
$r = new \ReflectionMethod($this, 'getEventDispatcher');
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Usage of method "%s" is deprecated since version 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', get_class($this).'::getEventDispatcher'), E_USER_DEPRECATED);

$this->dispatcher = $this->getEventDispatcher();
}
}
if (null === $this->dispatcher) {
$this->dispatcher = parent::getContainer()->get('event_dispatcher');
$this->dispatcher = $this->getEventDispatcher();
}

$io = new SymfonyStyle($input, $output);
Expand All @@ -130,14 +110,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
/**
* Loads the Event Dispatcher from the container.
*
* @return EventDispatcherInterface
* BC to removed in 4.0
*
* @deprecated since version 3.4, to be removed in 4.0
* @return EventDispatcherInterface
*/
protected function getEventDispatcher()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deprecated since 3.4 and will be removed in 4.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);

return parent::getContainer()->get('event_dispatcher');
return $this->getContainer()->get('event_dispatcher');
}
}
18 changes: 3 additions & 15 deletions
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ public function __construct($router = null)
$this->router = $router;
}

/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

/**
* {@inheritdoc}
*
Expand All @@ -74,10 +62,10 @@ public function isEnabled()
if (null !== $this->router) {
return parent::isEnabled();
}
if (!parent::getContainer()->has('router')) {
if (!$this->getContainer()->has('router')) {
return false;
}
$router = parent::getContainer()->get('router');
$router = $this->getContainer()->get('router');
if (!$router instanceof RouterInterface) {
return false;
}
Expand Down Expand Up @@ -118,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
// BC to be removed in 4.0
if (null === $this->router) {
$this->router = parent::getContainer()->get('router');
$this->router = $this->getContainer()->get('router');
}

$io = new SymfonyStyle($input, $output);
Expand Down
18 changes: 3 additions & 15 deletions src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,6 @@ public function __construct($router = null)
$this->router = $router;
}

/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

/**
* {@inheritdoc}
*
Expand All @@ -72,10 +60,10 @@ public function isEnabled()
if (null !== $this->router) {
return parent::isEnabled();
}
if (!parent::getContainer()->has('router')) {
if (!$this->getContainer()->has('router')) {
return false;
}
$router = parent::getContainer()->get('router');
$router = $this->getContainer()->get('router');
if (!$router instanceof RouterInterface) {
return false;
}
Expand Down Expand Up @@ -118,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
// BC to be removed in 4.0
if (null === $this->router) {
$this->router = parent::getContainer()->get('router');
$this->router = $this->getContainer()->get('router');
}

$io = new SymfonyStyle($input, $output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@ public function __construct($translator = null, TranslationLoader $loader = null
$this->extractor = $extractor;
}

/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -152,9 +140,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
// BC to be removed in 4.0
if (null === $this->translator) {
$this->translator = parent::getContainer()->get('translator');
$this->loader = parent::getContainer()->get('translation.loader');
$this->extractor = parent::getContainer()->get('translation.extractor');
$this->translator = $this->getContainer()->get('translator');
$this->loader = $this->getContainer()->get('translation.loader');
$this->extractor = $this->getContainer()->get('translation.extractor');
}

$io = new SymfonyStyle($input, $output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@ public function __construct($writer = null, TranslationLoader $loader = null, Ex
$this->defaultLocale = $defaultLocale;
}

/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -137,10 +125,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
// BC to be removed in 4.0
if (null === $this->writer) {
$this->writer = parent::getContainer()->get('translation.writer');
$this->loader = parent::getContainer()->get('translation.loader');
$this->extractor = parent::getContainer()->get('translation.extractor');
$this->defaultLocale = parent::getContainer()->getParameter('kernel.default_locale');
$this->writer = $this->getContainer()->get('translation.writer');
$this->loader = $this->getContainer()->get('translation.loader');
$this->extractor = $this->getContainer()->get('translation.extractor');
$this->defaultLocale = $this->getContainer()->getParameter('kernel.default_locale');
}

$io = new SymfonyStyle($input, $output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,14 @@
*/
class WorkflowDumpCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
protected function getContainer()
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);

return parent::getContainer();
}

5D75 /**
* {@inheritdoc}
*
* BC to be removed in 4.0
*/
public function isEnabled()
{
return parent::getContainer()->has('workflow.registry');
return $this->getContainer()->has('workflow.registry');
}

/**
Expand Down
0