Magento 2 实例 AccountManagement 命令
Magento 2 instance AccountManagement on Command
如何在自定义模块的命令中实例化 Magento\Customer\Model\AccountManagement
?
我正在尝试创建一个命令来重置所有客户的密码
您可能只对 AccountManagementInterface
使用 DI,就像摘自 Magento's code 的这个片段:
class Command
{
public function __construct(
AccountManagementInterface $customerAccountManagement
) {
$this->customerAccountManagement = $customerAccountManagement;
}
public function whatever() {
$this->customerAccountManagement->initiatePasswordReset(
$email,
AccountManagement::EMAIL_RESET
);
}
}
如何在自定义模块的命令中实例化 Magento\Customer\Model\AccountManagement
?
我正在尝试创建一个命令来重置所有客户的密码
您可能只对 AccountManagementInterface
使用 DI,就像摘自 Magento's code 的这个片段:
class Command
{
public function __construct(
AccountManagementInterface $customerAccountManagement
) {
$this->customerAccountManagement = $customerAccountManagement;
}
public function whatever() {
$this->customerAccountManagement->initiatePasswordReset(
$email,
AccountManagement::EMAIL_RESET
);
}
}