Skip to content

Commit d506599

Browse files
committed
minor #14168 Migrate Yaml config for DI calls to new syntax (greg0ire)
This PR was merged into the 4.4 branch. Discussion ---------- Migrate Yaml config for DI calls to new syntax From https://symfony.com/blog/new-in-symfony-4-4-dependency-injection-improvements-part-2 > [It is] more concise, and easier to read/write. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- c9a6c9c Migrate Yaml config for DI calls to new syntax
2 parents e9c6102 + c9a6c9c commit d506599

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

components/dependency_injection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ config files:
259259
newsletter_manager:
260260
class: NewsletterManager
261261
calls:
262-
- [setMailer, ['@mailer']]
262+
- setMailer: ['@mailer']
263263
264264
.. code-block:: xml
265265

service_container/calls.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ To configure the container to call the ``setLogger`` method, use the ``calls`` k
4040
App\Service\MessageGenerator:
4141
# ...
4242
calls:
43-
- [setLogger, ['@logger']]
43+
- setLogger: ['@logger']
4444
4545
.. code-block:: xml
4646

service_container/injection_types.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ In order to use this type of injection, don't forget to configure it:
150150
app.newsletter_manager:
151151
class: App\Mail\NewsletterManager
152152
calls:
153-
- [withMailer, ['@mailer'], true]
153+
- withMailer: !returns_clone ['@mailer']
154154
155155
.. code-block:: xml
156156
@@ -244,7 +244,7 @@ that accepts the dependency::
244244
app.newsletter_manager:
245245
class: App\Mail\NewsletterManager
246246
calls:
247-
- [setMailer, ['@mailer']]
247+
- setMailer: ['@mailer']
248248
249249
.. code-block:: xml
250250

service_container/optional_dependencies.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ call if the service exists and remove the method call if it does not:
6868
services:
6969
App\Newsletter\NewsletterManager:
7070
calls:
71-
- [setLogger, ['@?logger']]
71+
- setLogger: ['@?logger']
7272
7373
.. code-block:: xml
7474

service_container/parent_services.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ duplicated service definitions:
7272
abstract: true
7373
arguments: ['@doctrine.orm.entity_manager']
7474
calls:
75-
- [setLogger, ['@logger']]
75+
- setLogger: ['@logger']
7676
7777
App\Repository\DoctrineUserRepository:
7878
# extend the App\Repository\BaseDoctrineRepository service

session/database.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ First, define a Symfony service for the connection to the Redis server:
3030
# you can also use \RedisArray, \RedisCluster or \Predis\Client classes
3131
class: Redis
3232
calls:
33-
- method: connect
34-
arguments:
35-
- '%env(REDIS_HOST)%'
36-
- '%env(int:REDIS_PORT)%'
33+
- connect:
34+
- '%env(REDIS_HOST)%'
35+
- '%env(int:REDIS_PORT)%'
3736
3837
# uncomment the following if your Redis server requires a password
39-
# - method: auth
40-
# arguments:
41-
# - '%env(REDIS_PASSWORD)%'
38+
# - auth:
39+
# - '%env(REDIS_PASSWORD)%'
4240
4341
.. code-block:: xml
4442

0 commit comments

Comments
 (0)