在Magento 2中如何覆盖核心客户模型?

时间:2016-03-09 12:56:24

标签: magento2

我必须在自定义模块中覆盖客户ResourceModel的customer.php文件。

我已经尝试了但是它没有工作。那么什么是覆盖模型的正确方法? 请帮帮我。

我按照以下步骤覆盖模型,

我有自己的名为Namespace_Module的模块,带有di.xml文件,

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="Magento\Customer\Model\ResourceModel\Customer" type="Namespace\Modulename\Model\ResourceModel\Customer" />
</config>

然后我创建了php文件,

Namespace\Modulename\Model\ResourceModel\Customer.php 

并尝试覆盖核心文件。但它不适用于我。

所以任何人都可以帮助我解决我的问题。 感谢。

0 个答案:

没有答案
相关问题