Skip to content

Commit 04903f7

Browse files
committed
Update some examples using 3.3 features
1 parent 34b1478 commit 04903f7

File tree

5 files changed

+57
-130
lines changed

5 files changed

+57
-130
lines changed

console/commands_as_services.rst

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ with ``console.command``:
2727
2828
# app/config/config.yml
2929
services:
30-
app.command.my_command:
31-
class: AppBundle\Command\MyCommand
32-
tags: [console.command]
30+
AppBundle\Command\MyCommand: [console.command]
3331
3432
.. code-block:: xml
3533
@@ -41,8 +39,7 @@ with ``console.command``:
4139
http://symfony.com/schema/dic/services/services-1.0.xsd">
4240
4341
<services>
44-
<service id="app.command.my_command"
45-
class="AppBundle\Command\MyCommand">
42+
<service id="AppBundle\Command\MyCommand">
4643
<tag name="console.command" />
4744
</service>
4845
</services>
@@ -53,8 +50,7 @@ with ``console.command``:
5350
// app/config/config.php
5451
use AppBundle\Command\MyCommand;
5552
56-
$container
57-
->register('app.command.my_command', MyCommand::class)
53+
$container->register(MyCommand::class)
5854
->addTag('console.command')
5955
;
6056
@@ -131,8 +127,7 @@ inject the ``command.default_name`` parameter:
131127
command.default_name: Javier
132128
133129
services:
134-
app.command.my_command:
135-
class: AppBundle\Command\MyCommand
130+
AppBundle\Command\MyCommand:
136131
arguments: ["%command.default_name%"]
137132
tags: [console.command]
138133
@@ -150,8 +145,7 @@ inject the ``command.default_name`` parameter:
150145
</parameters>
151146
152147
<services>
153-
<service id="app.command.my_command"
154-
class="AppBundle\Command\MyCommand">
148+
<service class="AppBundle\Command\MyCommand">
155149
<argument>%command.default_name%</argument>
156150
<tag name="console.command" />
157151
</service>
@@ -166,7 +160,7 @@ inject the ``command.default_name`` parameter:
166160
$container->setParameter('command.default_name', 'Javier');
167161
168162
$container
169-
->register('app.command.my_command', MyCommand::class)
163+
->register(MyCommand::class)
170164
->setArguments(array('%command.default_name%'))
171165
->addTag('console.command')
172166
;

form/type_guesser.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ and tag it with ``form.type_guesser``:
188188
services:
189189
# ...
190190
191-
AppBundle\Form\TypeGuesser\PHPDocTypeGuesser:
192-
tags: [form.type_guesser]
191+
AppBundle\Form\TypeGuesser\PHPDocTypeGuesser: [form.type_guesser]
193192
194193
.. code-block:: xml
195194

0 commit comments

Comments
 (0)