File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,6 +141,8 @@ You can declare a service by providing a deferred resolver function for it.
141141The service container will call that function for the first time the service
142142is requested and remember the result.
143143
144+ This pattern is often called * lazy initialization* .
145+
144146- ` ::deferred(string $serviceId, callable $resolver): void ` &mdash ; Provide a deferred resolver for the given service name.
145147
146148* Note: the callback function parameters are auto-wired the same way as with the ` ->call() ` API.*
@@ -166,7 +168,7 @@ assert($connection === $same_connection); // The same instance
166168You can also provide a factory function to be used to construct a new service instance
167169every time it is requested.
168170
169- It works very similarly to ` ->resolver () ` , but calls the factory function every time.
171+ It works very similarly to ` ->deferred () ` , but calls the factory function every time.
170172
171173- ` ::factory(string $serviceId, callable $factory): void ` &mdash ; Bind a service to a factory function to be called every time it is requested.
172174
You can’t perform that action at this time.
0 commit comments