Skip to content

Commit 9d669a6

Browse files
armetizweaverryan
authored andcommitted
Fix the getTransport function.
1 parent d378a46 commit 9d669a6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

components/dependency_injection/tags.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ run when the container is compiled::
161161
Adding additional attributes on Tags
162162
------------------------------------
163163

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+
164167
To begin with, change the ``TransportChain`` class::
165168

166169
class TransportChain
@@ -177,9 +180,14 @@ To begin with, change the ``TransportChain`` class::
177180
$this->transports[$alias] = $transport;
178181
}
179182

180-
public function addTransport($alias)
183+
public function getTransport($alias)
181184
{
182-
return $this->transports[];
185+
if (array_key_exists($alias, $this->transports)) {
186+
return $this->transports[$alias];
187+
}
188+
else {
189+
return null;
190+
}
183191
}
184192
}
185193

0 commit comments

Comments
 (0)