File tree 1 file changed +0
-43
lines changed
components/dependency_injection 1 file changed +0
-43
lines changed Original file line number Diff line number Diff line change @@ -140,49 +140,6 @@ rather than being tied up and hidden with the service definition:
140
140
If you were using this elsewhere as well, then you would only need to change
141
141
the parameter value in one place if needed.
142
142
143
- You can also use the parameters in the service definition, for example,
144
- making the class of a service a parameter:
145
-
146
- .. configuration-block ::
147
-
148
- .. code-block :: yaml
149
-
150
- parameters :
151
- mailer.transport : sendmail
152
-
153
- services :
154
- mailer :
155
- class : Mailer
156
- arguments : ["%mailer.transport%"]
157
-
158
- .. code-block :: xml
159
-
160
- <?xml version =" 1.0" encoding =" UTF-8" ?>
161
- <container xmlns =" http://symfony.com/schema/dic/services"
162
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
163
- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
164
-
165
- <parameters >
166
- <parameter key =" mailer.transport" >sendmail</parameter >
167
- </parameters >
168
-
169
- <services >
170
- <service id =" mailer" class =" Mailer" >
171
- <argument >%mailer.transport%</argument >
172
- </service >
173
- </services >
174
- </container >
175
-
176
- .. code-block :: php
177
-
178
- use Symfony\Component\DependencyInjection\Reference;
179
-
180
- $container->setParameter('mailer.transport', 'sendmail');
181
-
182
- $container
183
- ->register('mailer', 'Mailer')
184
- ->addArgument('%mailer.transport%');
185
-
186
143
.. note ::
187
144
188
145
The percent sign inside a parameter or argument, as part of the string, must
You can’t perform that action at this time.
0 commit comments