File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
components/dependency_injection Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,9 @@ run when the container is compiled::
161
161
Adding additional attributes on Tags
162
162
------------------------------------
163
163
164
+ Sometimes you need additional information about each service that's tagged with your tag.
165
+ For example, add an alias to our TransportChain
166
+
164
167
To begin with, change the ``TransportChain `` class::
165
168
166
169
class TransportChain
@@ -177,9 +180,14 @@ To begin with, change the ``TransportChain`` class::
177
180
$this->transports[$alias] = $transport;
178
181
}
179
182
180
- public function addTransport ($alias)
183
+ public function getTransport ($alias)
181
184
{
182
- return $this->transports[];
185
+ if (array_key_exists($alias, $this->transports)) {
186
+ return $this->transports[$alias];
187
+ }
188
+ else {
189
+ return null;
190
+ }
183
191
}
184
192
}
185
193
You can’t perform that action at this time.
0 commit comments