Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/guides/v2.3/extension-dev-guide/proxies.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,13 @@ With the proxy used in place of `SlowLoading`, the `SlowLoading` class will not
Because DI configuration is used to inject a proxy, proxies can be dropped in to replace their corresponding classes - or proxy replacements _removed_ - without touching application code.

As a practical example of a proxy, you can see the [StoreManager]({{ site.mage2bloburl }}/{{ page.guide_version }}/app/code/Magento/Store/Model/StoreManager.php){:target="_blank"} class and then see the generated `StoreManager` proxy class.

The following excerpt from the Magento code passes the `storeManager` argument as a proxy to the `Magento\Store\Model\Resolver\Store` class. The `StoreManagerInterface` model is defined as a proxy class by the added `Proxy` at the end of the original class in the `di.xml` file.

```xml
<type name="Magento\Store\Model\Resolver\Store">
<arguments>
<argument name="storeManager" xsi:type="object">Magento\Store\Model\StoreManagerInterface\Proxy</argument>
</arguments>
</type>
```