File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -18,13 +18,13 @@ add the following to it::
18
18
// src/Acme/DemoBundle/Command/GreetCommand.php
19
19
namespace Acme\DemoBundle\Command;
20
20
21
- use Symfony\Bundle\FrameworkBundle\Command\Command ;
21
+ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand ;
22
22
use Symfony\Component\Console\Input\InputArgument;
23
23
use Symfony\Component\Console\Input\InputInterface;
24
24
use Symfony\Component\Console\Input\InputOption;
25
25
use Symfony\Component\Console\Output\OutputInterface;
26
26
27
- class GreetCommand extends Command
27
+ class GreetCommand extends ContainerAwareCommand
28
28
{
29
29
protected function configure()
30
30
{
@@ -204,7 +204,7 @@ example, you could easily extend the task to be translatable::
204
204
protected function execute(InputInterface $input, OutputInterface $output)
205
205
{
206
206
$name = $input->getArgument('name');
207
- $translator = $this->container ->get('translator');
207
+ $translator = $this->getContainer() ->get('translator');
208
208
if ($name) {
209
209
$output->writeln($translator->trans('Hello %name%!', array('%name%' => $name)));
210
210
} else {
You can’t perform that action at this time.
0 commit comments