Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 6c00676

Browse files
authored
Merge pull request #9335 from #9335
[Imported] Refactoring sample code due to current code is obsolete
2 parents 5881289 + c819360 commit 6c00676

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/guides/v2.3/extension-dev-guide/build/di-xml-file.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,20 +263,20 @@ The `preference` node specifies the default implementation:
263263
```xml
264264
<!-- File: app/etc/di.xml -->
265265
<config>
266-
<preference for="Magento\Core\Model\UrlInterface" type="Magento\Core\Model\Url" />
266+
<preference for="Magento\Framework\UrlInterface" type="Magento\Framework\Url" />
267267
</config>
268268
```
269269

270-
This mapping is in `app/etc/di.xml`, so the object manager injects the `Magento\Core\Model\Url` implementation class wherever there is a request for the `Magento\Core\Model\UrlInterface` in the global scope.
270+
This mapping is in `app/etc/di.xml`, so the object manager injects the `Magento\Framework\Url` implementation class wherever there is a request for the `Magento\Framework\UrlInterface` in the global scope.
271271

272272
```xml
273273
<!-- File: app/code/Magento/Backend/etc/adminhtml/di.xml -->
274274
<config>
275-
<preference for="Magento\Core\Model\UrlInterface" type="Magento\Backend\Model\Url" />
275+
<preference for="Magento\Framework\UrlInterface" type="Magento\Backend\Model\UrlInterface" />
276276
</config>
277277
```
278278

279-
This mapping is in `app/code/Magento/Backend/etc/adminhtml/di.xml`, so the object manager injects the `Magento\Backend\Model\Url` implementation class wherever there is a request for the `Magento\Core\Model\UrlInterface` in the [admin](https://glossary.magento.com/admin) area.
279+
This mapping is in `app/code/Magento/Backend/etc/adminhtml/di.xml`, so the object manager injects the `Magento\Backend\Model\UrlInterface` implementation class wherever there is a request for the `Magento\Framework\UrlInterface` in the [admin](https://glossary.magento.com/admin) area.
280280

281281
### Override a method using 'preference' nodes
282282

@@ -363,7 +363,7 @@ Any descendant can override the parameters configured for its supertype; that is
363363
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
364364
<type name="Magento\Framework\View\Element\Context">
365365
<arguments>
366-
<argument name="urlBuilder" xsi:type="object">Magento\Core\Model\Url</argument>
366+
<argument name="urlBuilder" xsi:type="object">Magento\Framework\Url</argument>
367367
</arguments>
368368
</type>
369369
<type name="Magento\Backend\Block\Context">
@@ -376,7 +376,7 @@ Any descendant can override the parameters configured for its supertype; that is
376376

377377
In the preceding example, [`Magento\Backend\Block\Context`]({{ site.mage2bloburl }}/{{ page.guide_version }}/app/code/Magento/Backend/Block/Context.php) is a descendant of [`Magento\Framework\View\Element\Context`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/View/Element/Context.php).
378378

379-
The first entry configures all instances of `Magento\Framework\View\Element\Context` as well as its children to pass in [`Magento\Core\Model\Url`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Url.php) as `$urlBuilder` in their constructors.
379+
The first entry configures all instances of `Magento\Framework\View\Element\Context` as well as its children to pass in [`Magento\Framework\Url`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Url.php) as `$urlBuilder` in their constructors.
380380

381381
The second entry overrides this and configures all instances of `Magento\Backend\Block\Context` to use [`Magento\Backend\Model\Url`]({{ site.mage2bloburl }}/{{ page.guide_version }}/app/code/Magento/Backend/Model/Url.php) as the `$urlBuilder` instead.
382382

0 commit comments

Comments
 (0)