1

Considering below in etc/di.xml:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Setup\Console\Command\MaintenanceEnableCommand">
        <plugin name="custom_maintenance" type="Custom\Module\Console\Command\MaintenanceEnableCommand" />
    </type>
</config>

wondering why below in Custom\Module\Console\Command\MaintenanceEnableCommand path does not get executed?

public function afterIsEnable(\Magento\Setup\Console\Command\MaintenanceEnableCommand $subject)
    {
        echo "in plugin";

    }
1

Magento 2 Plugins (Interceptors) only work on public functions. The function isEnable() is protected

Magento's documentation on Plugins can be found here for further understanding - https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html

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.