You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-4Lines changed: 35 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,21 +52,52 @@ return [
52
52
53
53
# Usage
54
54
55
-
Any existing service will directly be available through the Service Manager of Zend:
55
+
Refer to the documentation of the [Symfony DI Component](https://symfony.com/doc/3.4/components/dependency_injection.html) for information on how to use the DI container.
56
+
57
+
#### Obtain a symfony defined service
58
+
59
+
Any existing symfony service will directly be available through the Service Manager of Zend:
#### Build a symfony defined service with a Zend service dependency
68
+
69
+
It will happen that you have to use a dependency which is already loaded into the Zend Service Manager. For example, if you are using the Doctrine Module and you
70
+
need to have the instance of the Entity Manager, you can leverage the ZendServiceProxyFactory class:
71
+
72
+
```yaml
73
+
services:
74
+
75
+
_defaults:
76
+
77
+
autowire: true # Automatically injects dependencies in your services.
78
+
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
79
+
public: false # Allows optimizing the container by removing unused services; this also means
80
+
# fetching services directly from the container via $container->get() won't work.
81
+
# The best practice is to be explicit about your dependencies anyway.
82
+
83
+
#
84
+
# Define service that needs to be retrieved via the Zend Service Manager
With this configuration, and service defined with the symfony container requiring an instance of Doctrine\ORM\EntityManagerInterface will receive this from
Refer to the documentation of the [Symfony DI Component](https://symfony.com/doc/3.4/components/dependency_injection.html) for more information on how to use the container.
0 commit comments