Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b8edbee

Browse filesBrowse files
committed
Small tweak to new DIC chapter thanks to @richardmiller - see #1108
1 parent 8908389 commit b8edbee
Copy full SHA for b8edbee

File tree

Expand file treeCollapse file tree

3 files changed

+6
-4
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+6
-4
lines changed

‎components/dependency_injection.rst

Copy file name to clipboardExpand all lines: components/dependency_injection.rst
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ it a parameter in the container and then referring to this parameter for the
9292
$sc = new ContainerBuilder();
9393
$sc->setParameter('mailer.transport', 'sendmail');
9494
$sc->register('mailer', 'Mailer')
95-
->addArgument('%sendmail%'));
95+
->addArgument('%mailer.transport%'));
9696
9797
Now that the ``mailer`` service is in the container you can inject it as
9898
a dependency of other classes. If you have a ``NewsletterManager`` class
@@ -125,7 +125,7 @@ Then you can register this as a service as well and pass the ``mailer`` service
125125
126126
$sc->setParameter('mailer.transport', 'sendmail');
127127
$sc->register('mailer', 'Mailer')
128-
->addArgument('%sendmail%'));
128+
->addArgument('%mailer.transport%'));
129129
130130
$sc->register('newsletter_manager', 'NewsletterManager')
131131
->addArgument(new Reference('mailer'));
@@ -161,7 +161,7 @@ If you do want to though then the container can call the setter method:
161161
162162
$sc->setParameter('mailer.transport', 'sendmail');
163163
$sc->register('mailer', 'Mailer')
164-
->addArgument('%sendmail%'));
164+
->addArgument('%mailer.transport%'));
165165
166166
$sc->register('newsletter_manager', 'NewsletterManager')
167167
->addMethodCall('setMailer', new Reference('mailer'));
@@ -274,7 +274,7 @@ The ``newsletter_manager`` and `` mailer`` services can be set up using config f
274274
// ...
275275
$sc->setParameter('mailer.transport', 'sendmail');
276276
$sc->register('mailer', 'Mailer')
277-
->addArgument('%sendmail%'));
277+
->addArgument('%mailer.transport%'));
278278
279279
$sc->register('newsletter_manager', 'NewsletterManager')
280280
->addMethodCall('setMailer', new Reference('mailer'));

‎components/index.rst

Copy file name to clipboardExpand all lines: components/index.rst
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The Components
88
console
99
css_selector
1010
dom_crawler
11+
dependency_injection
1112
finder
1213
http_foundation
1314
locale

‎components/map.rst.inc

Copy file name to clipboardExpand all lines: components/map.rst.inc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
* :doc:`/components/class_loader`
22
* :doc:`/components/console`
33
* :doc:`/components/css_selector`
4+
* :doc:`/components/dependency_injection`
45
* :doc:`/components/dom_crawler`
56
* :doc:`/components/finder`
67
* :doc:`/components/http_foundation`

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.