2

If a class has plugins and the deploy mode is set to developer the ObjectManager is supposed to generate an Interceptor of the class as needed. That's what happens when running bin/magento setup:di:compile.

In my case some Inteceptors are not generated even tho the class has at least one plugin.

I'm trying to add a plugin for a third party class. di.xml and the after method are declared correctly and the target method is called. Due to the missing Interceptor the plugin isn't executed.

If I run bin/magento setup:di:compile the Interceptor is generated and the plugin works as intended.

I tried to debug into \Magento\Framework\Interception\ObjectManager\Config\Developer::getInstanceType but here I don't get an instance of the class I target with the plugin.

Any ideas what the problem could be?

Update:
I've debugged into the index.php and checked the state of $app. _appMode is set to developer. So I don't think the app mode is overwritten somewhere.

  • did you try to upgrade first before running compile? – fmsthird Apr 18 at 21:31
  • I did run a upgrade. The compile when I run bin/magento setup:di:compile works just fine but I am in developer mode so it should not be necessary to trigger it manually – Daniel Apr 23 at 9:59
-2
  • It will not automatically be generated when you are using production mode. Please check your mode by command:

    php bin/magento deploy:mode:show
    
  • Enable this setting:

Stores => Configuration => Advanced => Developer => Template Settings

  • 1
    already checked it is development – Daniel Apr 18 at 16:53

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.