context 类

4.75K 浏览M2交流区

context 类

MagentoFrameworkAppActionContext $context

这是一个什么样的类 经常见到  中文意思总是不清晰

0

/**
* Constructor modification point for MagentoFrameworkAppAction.
*
* All context classes were introduced to allow for backwards compatible constructor modifications
* of classes that were supposed to be extended by extension developers.
*
* Do not call methods of this class directly.
*
* As Magento moves from inheritance-based APIs all such classes will be deprecated together with
* the classes they were introduced for.
*
* @api
* @since 100.0.2
*/

总体来说,这个类是给控制器提供一些默认的类(相当于公共类),便于调用,把公共常用的类放在这个类里,你打开这个文件看下就知道了,构造函数里面都是些常用的类。
貌似以后会抛弃这个类,不再使用,因为以后都只走api。

0

好的 谢谢站长

0