Skip to content

Initialize the AccountManagementInterface with my own class problem #3627

@cs221313

Description

@cs221313

Hi, all,

I got a problem when I Initialize the AccountManagementInterface with my own class. I have created my own AccountManagement which is extended from \Magento\Customer\Model\AccountManagement.

namespace AiMai\MyModule\Model;

class AccountManagement extends \Magento\Customer\Model\AccountManagement implements AccountManagementInterface
{
...
}

I defined following statement in di.xml file:

\<preference for="Magento\Customer\Api\AccountManagementInterface"
                 type="AiMai\MyModule\Model\AccountManagement" />

But when I run the software, it still initialize the Magento\Customer\Model\AccountManagement class in the following code.

class ForgotPasswordPost extends \Magento\Customer\Controller\Account\ForgotPasswordPost
{
    public function __construct(Context $context, Session $customerSession, AccountManagementInterface $customerAccountManagement, Escaper $escaper)
    {
        parent::__construct($context, $customerSession, $customerAccountManagement, $escaper);
    }
...}

Thanks

  • David

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions