-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugins/Interceptors Don't Work with Early Stage Single Instance Objects in Developer Mode #2674
Comments
@astorm I'm facing similar issues but I dont have a problem with plugins but with |
@xhallix Yes, it's the same problem. Basically, the developer mode object manager needs to instantiate some classes before the di.xml files are fully loaded. That includes class preferences. Compile your di stuff with |
Thank you for reporting. |
@astorm how did you get that list of which classes won't be interceptable? |
@ColdGreenTea I dropped the following debugging code into my system
In plain english, this code basically says
Then, I ran through some user flows in the browser on both the frontend and backend, then |
…y Stage Single Instance Objects in Developer Mode
…y Stage Single Instance Objects in Developer Mode
…y Stage Single Instance Objects in Developer Mode - 2.0.1 release
This issue has been resolved and merged to develop. Feel free to let us know if you encounter any other issues. |
…amespace-agnostic [borg] MAGETWO-92468: Make PR testsuite namespace-agnostic
encountering same issue when trying to overload sortRatesByPrice() core function of \Magento\Shipping\Model\Rate\Result Class. |
2024, Adobe Commerce 2.4.6-p6 and the |
If I enable developer mode by adding the following to my .htacess file
and then add a plugin configuration
Magento doesn't seem to see the plugin until I do a full compile
Expected Behavior: When Magento developer mode is enabled, all plugins are active immediately. From an end-client-programmer-user perspective the plugin system should behave the same in all Magento modes (developer, production, default, etc.) irrespective of the implementation details
Actual Behavior: Magento doesn't recognize certain plugins until the
setup:di:compile
command is runNotes
I believe this problem is limited to what I'd call early stage single-instance-object instantiation. If the object manager creates an instance/singleton object (i.e. via
get
) before the framework loads the di configuration, that instance/singleton is cached in the object manager. Since the object manager, by definition, caches instance/singleton objects, this means these early stage objects never have a chance to be intercepted in developer mode.That is, in
The
$this->interceptionConfig
is false for a time. In a quick test on the 2.0 system, that means the following classes are "un-intercept-able" by the developer mode object manager (without a compile)Not sure what the right fix here is. My naive approach to something like this would be to
That said, as a third-part I wouldn't presume to come up with a solution myself as this is the sort of thing that will have impact system wide across multiple teams.
Right now if developers are trying to plugin to one of the above classes while working in developer mode they're going to spin their wheels for a bit before realize them need to run
setup:di:compile
even though developer mode is supposed, and sometimes does, make that unnecessary. That's the problem I'd be interested in seeing solved.The text was updated successfully, but these errors were encountered: