Add new API to Magento module
Domanda
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~!
Soluzione
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
Altri suggerimenti
You should not extend Interfaces of other modules. Just add new calls in your.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange