我试图从我的自定义模块中的Magento \ Eav \ Model \ ResourceModel \ Entity \ Attribute覆盖_processAttributeOptions()方法。但该功能不会覆盖。这是我的代码:
命名空间\ MODULE_NAME \等\ di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Eav\Model\ResourceModel\Entity\Attribute" type="Namespace\Module_Name\Model\ResourceModel\Entity\Attribute" />
</config>
命名空间\ MODULE_NAME \型号\ ResourceModel \实体\属性
<?php
namespace Namespace\Module_Name\Model\ResourceModel\Entity;
class Attribute extends \Magento\Eav\Model\ResourceModel\Entity\Attribute
{
protected function _processAttributeOptions($object, $option)
{
//here is my custom code with core
}
}
请帮我在Magento 2.2中覆盖这个方法。
如果以小写形式输入命名空间和模块名称,则尝试将其替换为带有namespace\module_name
的Namespace\Module
等CamelCase,并重命名文件夹。