2

Is it possible to extends virtual type class declared in di.xml ? If yes how ?

2

Most probably you can't directly extend the virtual class in php file. But you can do with di.xml itself. Take this example, this may help you.

<virtualType name="SectionInvalidationConfigReader" type="Magento\Framework\Config\Reader\Filesystem">
    <arguments>
        <argument name="idAttributes" xsi:type="array">
            <item name="/config/action" xsi:type="string">name</item>
            <item name="/config/action/section" xsi:type="string">name</item>
        </argument>
        <argument name="fileName" xsi:type="string">sections.xml</argument>
        <argument name="converter" xsi:type="object">\Magento\Customer\CustomerData\SectionConfigConverter</argument>
        <argument name="schemaLocator" xsi:type="object">Magento\Customer\CustomerData\SchemaLocator</argument>
        <argument name="defaultScope" xsi:type="string">frontend</argument>
    </arguments>
</virtualType>
<virtualType name="SectionInvalidationConfigData" type="Magento\Framework\Config\Data">
    <arguments>
        <argument name="reader" xsi:type="object">SectionInvalidationConfigReader</argument>
        <argument name="cacheId" xsi:type="string">sections_invalidation_config</argument>
    </arguments>
</virtualType>
<type name="Magento\Customer\Block\SectionConfig">
    <arguments>
        <argument name="sectionConfig" xsi:type="object">SectionInvalidationConfigData</argument>
    </arguments>
</type>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.