Is their any way to override createAccountWithPasswordHash
method from
Magento\Customer\Model\AccountManagement
file ?
i tried etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Customer\Model\AccountManagement" type="Vendor\Customer\Model\AccountManagement" />
</config>
Vendor/Customer/Model/AccountManagement.php
<?php
namespace Vendor\Customer\Model;
/**
* Handle various customer account actions
*/
class AccountManagement extends \Magento\Customer\Model\AccountManagement
{
public function createAccountWithPasswordHash(CustomerInterface $customer, $hash, $redirectUrl = '')
{
echo 'checkoverridecreateAccountWithPasswordHash'; exit;
}
}
Getting error on setup upgrade
PHP Fatal error: Could not check compatibility between Vendor\Customer\Model\AccountManagement::createAccountWithPasswordHash(Vendor\Customer\Model\CustomerInterface $customer, $hash, $redirectUrl = '') and Magento\Customer\Model\AccountManagement::createAccountWithPasswordHash(Magento\Customer\Api\Data\CustomerInterface $customer, $hash, $redirectUrl = ''), because class Vendor\Customer\Model\CustomerInterface is not available in /Vendor/Customer/Model/AccountManagement.php on line 10