8000 [WCM][Console] Remove mentions about the deprecated ContainerAwareCom… · symfony/symfony-docs@f3e8f0e · GitHub
[go: up one dir, main page]

Skip to content

Commit f3e8f0e

Browse files
committed
[WCM][Console] Remove mentions about the deprecated ContainerAwareCommand class
1 parent 984c3ef commit f3e8f0e

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

console/commands_as_services.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ recommended setup.
1313
You can also manually register your command as a service by configuring the service
1414
and :doc:`tagging it </service_container/tags>` with ``console.command``.
1515

16-
In either case, if your class extends :class:`Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerAwareCommand`,
17-
you can access public services via ``$this->getContainer()->get('SERVICE_ID')``.
18-
19-
But if your class is registered as a service, you can instead access services by
20-
using normal :ref:`dependency injection <services-constructor-injection>`.
21-
2216
For example, suppose you want to log something from within your command::
2317

2418
namespace App\Command;

console/style.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ Consider for example the code used to display the title of the following command
1313
// src/Command/GreetCommand.php
1414
namespace App\Command;
1515

16-
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
16+
use Symfony\Component\Console\Command\Command;
1717
use Symfony\Component\Console\Input\InputInterface;
1818
use Symfony\Component\Console\Output\OutputInterface;
1919

20-
class GreetCommand extends ContainerAwareCommand
20+
class GreetCommand extends Command
2121
{
2222
// ...
2323

@@ -53,12 +53,12 @@ title of the command::
5353
// src/Command/GreetCommand.php
5454
namespace App\Command;
5555

56-
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
56+
use Symfony\Component\Console\Command\Command;
5757
use Symfony\Component\Console\Style\SymfonyStyle;
5858
use Symfony\Component\Console\Input\InputInterface;
5959
use Symfony\Component\Console\Output\OutputInterface;
6060

61-
class GreetCommand extends ContainerAwareCommand
61+
class GreetCommand extends Command
6262
{
6363
// ...
6464

@@ -355,10 +355,11 @@ of your commands to change their appearance::
355355
namespace App\Console;
356356

357357
use App\Console\CustomStyle;
358+
use Symfony\Component\Console\Command\Command;
358359
use Symfony\Component\Console\Input\InputInterface;
359360
use Symfony\Component\Console\Output\OutputInterface;
360361

361-
class GreetCommand extends ContainerAwareCommand
362+
class GreetCommand extends Command
362363
{
363364
// ...
364365

0 commit comments

Comments
 (0)
0