Skip to content

Commit d88c391

Browse files
committed
Merge pull request #2162 from richardmiller/adding_di_example_note
Adding a note about finding more examples of working with DI definitions
2 parents 6145217 + 6e65171 commit d88c391

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

components/dependency_injection/definitions.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Getting and Setting Service Definitions
2828
There are also some helpful methods for
2929
working with the service definitions.
3030

31-
To find out if there is a definition for a service id::
31+
To find out if there is a definition for a service id::
3232

3333
$container->hasDefinition($serviceId);
3434

@@ -84,7 +84,7 @@ To get an array of the constructor arguments for a definition you can use::
8484

8585
or to get a single argument by its position::
8686

87-
$definition->getArgument($index);
87+
$definition->getArgument($index);
8888
//e.g. $definition->getArguments(0) for the first argument
8989

9090
You can add a new argument to the end of the arguments array using::
@@ -95,7 +95,7 @@ The argument can be a string, an array, a service parameter by using ``%paramete
9595
or a service id by using ::
9696

9797
use Symfony\Component\DependencyInjection\Reference;
98-
98+
9999
// ...
100100

101101
$definition->addArgument(new Reference('service_id'));
@@ -131,3 +131,9 @@ You can also replace any existing method calls with an array of new ones with::
131131

132132
$definition->setMethodCalls($methodCalls);
133133

134+
.. tip::
135+
136+
There are more examples of specific ways of working with definitions
137+
in the PHP code blocks of the configuration examples on pages such as
138+
:doc:`/components/dependency_injection/factories` and
139+
:doc:`/components/dependency_injection/parentservices`

0 commit comments

Comments
 (0)