Add new API to Magento module
سؤال
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~!
المحلول
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
نصائح أخرى
You should not extend Interfaces of other modules. Just add new calls in your.
لا تنتمي إلى magento.stackexchange