Skip to content

Commit 92ecbbf

Browse files
committed
MC-39765: No such entity with addressId, occurs randomly on visitors browser. System Log Generated
1 parent 3bb857f commit 92ecbbf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/code/Magento/Persistent/Observer/EmulateCustomerObserver.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
8787
/** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
8888
$customer = $this->customerRepository->getById($this->_persistentSession->getSession()->getCustomerId());
8989
if ($defaultShipping = $customer->getDefaultShipping()) {
90-
$address = $this->getCustomerAddressById($defaultShipping);
90+
$address = $this->getCustomerAddressById((int) $defaultShipping);
9191

9292
if ($address !== null) {
9393
$this->_customerSession->setDefaultTaxShippingAddress(
@@ -103,7 +103,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
103103
}
104104

105105
if ($defaultBilling = $customer->getDefaultBilling()) {
106-
$address = $this->getCustomerAddressById($defaultBilling);
106+
$address = $this->getCustomerAddressById((int) $defaultBilling);
107107

108108
if ($address !== null) {
109109
$this->_customerSession->setDefaultTaxBillingAddress([
@@ -127,7 +127,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
127127
* @param int $addressId
128128
* @return \Magento\Customer\Api\Data\AddressInterface|null
129129
*/
130-
private function getCustomerAddressById($addressId)
130+
private function getCustomerAddressById(int $addressId)
131131
{
132132
try {
133133
return $this->addressRepository->getById($addressId);

0 commit comments

Comments
 (0)