Created
June 5, 2024 14:22
-
-
Save MintayRibkins/1646b87768fa857b84c4f3f6d38c3d5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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