Skip to content

Commit 02c5ea8

Browse files
committed
Updating console for container changes
1 parent 53a2b31 commit 02c5ea8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cookbook/console.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ add the following to it::
1818
// src/Acme/DemoBundle/Command/GreetCommand.php
1919
namespace Acme\DemoBundle\Command;
2020

21-
use Symfony\Bundle\FrameworkBundle\Command\Command;
21+
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
2222
use Symfony\Component\Console\Input\InputArgument;
2323
use Symfony\Component\Console\Input\InputInterface;
2424
use Symfony\Component\Console\Input\InputOption;
2525
use Symfony\Component\Console\Output\OutputInterface;
2626

27-
class GreetCommand extends Command
27+
class GreetCommand extends ContainerAwareCommand
2828
{
2929
protected function configure()
3030
{
@@ -204,7 +204,7 @@ example, you could easily extend the task to be translatable::
204204
protected function execute(InputInterface $input, OutputInterface $output)
205205
{
206206
$name = $input->getArgument('name');
207-
$translator = $this->container->get('translator');
207+
$translator = $this->getContainer()->get('translator');
208208
if ($name) {
209209
$output->writeln($translator->trans('Hello %name%!', array('%name%' => $name)));
210210
} else {

0 commit comments

Comments
 (0)