@@ -38,11 +38,13 @@ with ``console.command``:
3838 <?xml version =" 1.0" encoding =" UTF-8" ?>
3939 <container xmlns =" http://symfony.com/schema/dic/services"
4040 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
41- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
41+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
42+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
4243
4344 <services >
4445 <service id =" acme_hello.command.my_command"
4546 class =" Acme\HelloBundle\Command\MyCommand" >
47+
4648 <tag name =" console.command" />
4749 </service >
4850 </services >
@@ -52,7 +54,10 @@ with ``console.command``:
5254
5355 // app/config/config.php
5456 $container
55- ->register('acme_hello.command.my_command', 'Acme\HelloBundle\Command\MyCommand')
57+ ->register(
58+ 'acme_hello.command.my_command',
59+ 'Acme\HelloBundle\Command\MyCommand'
60+ )
5661 ->addTag('console.command')
5762 ;
5863
@@ -63,7 +68,7 @@ Imagine you want to provide a default value for the ``name`` option. You could
6368pass one of the following as the 5th argument of ``addOption() ``:
6469
6570* a hardcoded string;
66- * a container parameter (e.g. something from parameters.yml);
71+ * a container parameter (e.g. something from `` parameters.yml `` );
6772* a value computed by a service (e.g. a repository).
6873
6974By extending ``ContainerAwareCommand ``, only the first is possible, because you
@@ -98,7 +103,13 @@ have some ``NameRepository`` service that you'll use to get your default value::
98103 $this
99104 ->setName('demo:greet')
100105 ->setDescription('Greet someone')
101- ->addOption('name', '-n', InputOption::VALUE_REQUIRED, 'Who do you want to greet?', $defaultName)
106+ ->addOption(
107+ 'name',
108+ '-n',
109+ InputOption::VALUE_REQUIRED,
110+ 'Who do you want to greet?',
111+ $defaultName
112+ )
102113 ;
103114 }
104115
0 commit comments