0

我试图在我的自定义模块中覆盖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 中覆盖此方法。

4

1 回答 1

0

如果您以小写形式输入命名空间和模块名称,请尝试用 CamelCase 替换它,例如namespace\module_namewithNamespace\Module并重命名文件夹。

于 2017-12-29T11:40:07.307 回答