@@ -38,11 +38,13 @@ with ``console.command``:
38
38
<?xml version =" 1.0" encoding =" UTF-8" ?>
39
39
<container xmlns =" http://symfony.com/schema/dic/services"
40
40
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" >
42
43
43
44
<services >
44
45
<service id =" acme_hello.command.my_command"
45
46
class =" Acme\HelloBundle\Command\MyCommand" >
47
+
46
48
<tag name =" console.command" />
47
49
</service >
48
50
</services >
@@ -52,7 +54,10 @@ with ``console.command``:
52
54
53
55
// app/config/config.php
54
56
$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
+ )
56
61
->addTag('console.command')
57
62
;
58
63
@@ -63,7 +68,7 @@ Imagine you want to provide a default value for the ``name`` option. You could
63
68
pass one of the following as the 5th argument of ``addOption() ``:
64
69
65
70
* a hardcoded string;
66
- * a container parameter (e.g. something from parameters.yml);
71
+ * a container parameter (e.g. something from `` parameters.yml `` );
67
72
* a value computed by a service (e.g. a repository).
68
73
69
74
By 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::
98
103
$this
99
104
->setName('demo:greet')
100
105
->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
+ )
102
113
;
103
114
}
104
115
0 commit comments