Question

I would like to add new API to Magento Customer module -> AccountManagementInterface.

I have created my custom module but I don't know how should my di.xml be written?

Thanks~!

Was it helpful?

Solution

You just need to add below code in di.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Customer\Api\AccountManagementInterface"
                type="Vendor\ModuleName\Model\Myaccountmanagement" />
</config>

Add your vendor and modulename in above code

Using above code you can implement AccountManagementInterface in your module which is defined in di.xml

OTHER TIPS

You should not extend Interfaces of other modules. Just add new calls in your.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top