我试图在我的自定义模块中覆盖Magento\Eav\Model\ResourceModel\Entity\Attribute中的_processAttributeOptions() 方法。但该功能不会覆盖。这是我的代码:
命名空间\Module_Name\etc\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\Model\ResourceModel\Entity\Attribute
<?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 中覆盖此方法。