AD0-E716 · Question #12
An Adobe Commerce developer has created a before plugin for the save() function within the Magento\Framework\App\cache\Proxy class. The purpose of this plugin is to add a prefix on all cache…
The correct answer is C. The target ClaSS implements Magento\Framework\ObjectManager\NoninterceptableInterface. According to the Plugins (Interceptors) guide for Magento 2 developers, plugins are class methods that modify the behavior of public class methods by intercepting them and running code before, after, or around them. However, some classes in Magento 2 implement the…
Question
An Adobe Commerce developer has created a before plugin for the save() function within the Magento\Framework\App\cache\Proxy class. The purpose of this plugin is to add a prefix on all cache identifiers that fulfill certain criteria. Why is the plugin not executing as expected?
Options
- AAnother around plugin defined for the same function does not call the callable.
- BCache identifiers are immutable and cannot be changed.
- CThe target ClaSS implements Magento\Framework\ObjectManager\NoninterceptableInterface.
How the community answered
(35 responses)- A14% (5)
- B26% (9)
- C60% (21)
Explanation
According to the Plugins (Interceptors) guide for Magento 2 developers, plugins are class methods that modify the behavior of public class methods by intercepting them and running code before, after, or around them. However, some classes in Magento 2 implement the NoninterceptableInterface interface, which prevents plugins from being generated for them. The Magento\Framework\App\cache\Proxy class is one of them, as it extends from Magento\Framework\ObjectManager\NoninterceptableInterface. Therefore, the plugin is not executing as expected because the target class implements NoninterceptableInterface. Verified
Topics
Community Discussion
No community discussion yet for this question.