Skip to content

Instantly share code, notes, and snippets.

@MintayRibkins
Created June 5, 2024 14:22
Show Gist options
  • Save MintayRibkins/1646b87768fa857b84c4f3f6d38c3d5a to your computer and use it in GitHub Desktop.
Save MintayRibkins/1646b87768fa857b84c4f3f6d38c3d5a to your computer and use it in GitHub Desktop.
<?php
namespace Buffetti\FormHelper\Plugin;
use Magento\Customer\Model\Customer;
use Magento\Customer\Model\CustomerRegistry;
use Magento\Framework\Exception\NoSuchEntityException;
use PHPUnit\Util\Exception;
/**
* @property \Magento\Customer\Model\Data\CustomerSecureFactory $customerFactory
*/
class CustomerRegistryOverride
{
/**
* @param CustomerRegistry $subject
* @param Customer $result
* @param string $customerEmail
* @param string|null $websiteId
* @return Customer
*/
public function aroundRetrieveByEmail(CustomerRegistry $subject, callable $proceed, $customerEmail, $websiteId = null)
{
try {
return $proceed($customerEmail, $websiteId);
} catch (NoSuchEntityException $e) {
throw new NoSuchEntityException(
__('qualcosa è andato storto')
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment