For example, anybody can modify this virtual type magento/module-catalog/etc/di.xml
:
<virtualType name="Magento\Catalog\Model\Layer\Search\Context" type="Magento\Catalog\Model\Layer\Context">
<arguments>
<argument name="collectionProvider" xsi:type="object">Magento\Catalog\Model\Layer\Search\ItemCollectionProvider</argument>
<argument name="stateKey" xsi:type="object">Magento\Catalog\Model\Layer\Category\StateKey</argument>
<argument name="collectionFilter" xsi:type="object">Magento\Catalog\Model\Layer\Search\CollectionFilter</argument>
</arguments>
</virtualType>
Let's assume that instead
Magento\Catalog\Model\Layer\Search\ItemCollectionProvider
now
Vendor\Name\Model\Layer\Search\ItemCollectionProvider
When I implement virtual type
(Magento\Catalog\Model\Layer\Search\Context
) in own class constructor I get fatal error:
Class Magento\Catalog\Model\Layer\Search\Context does not exist
It seems, that using of virtual types is allowed only in di.xml
I can inject in own class the class which use this context, but context is the protected property and i can't get it.
How I can find class
Vendor\Name\Model\Layer\Search\ItemCollectionProvider
from any place of code?