微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

试图在第 76 行访问类型为 null CustomerRepository.php 的值的数组偏移量?

如何解决试图在第 76 行访问类型为 null CustomerRepository.php 的值的数组偏移量?

我收到以下错误

{"0":"Notice: Trying to access array offset on value of type null in CustomerRepository.PHP on line 76"

这是CustomerRepository.PHP 文件

  public function afterGetById(\Magento\Customer\Model\ResourceModel\CustomerRepository $subject,$customer)
        {
            $customerObject = $this->helperContactPerson->customerFactory->create()->load($customer->getId());
            $extensionAttributes = $customer->getExtensionAttributes();
            if ($this->helperContactPerson->isContactPerson($customerObject)) {
                $customerData = $this->helperContactPerson->getCustomerId($customer->getId());
                $extensionAttributes->setCompanyId($customerData['customer_id']);
            }
            $currencyCode = $this->storeManager->getStore()->getCurrentCurrencyCode();
            $currency = $this->currencyFactory->create()->load($currencyCode);
            $currencySymbol = $currency->getCurrencySymbol();
            $extensionAttributes->setCurrencyCode($currencyCode);
            $extensionAttributes->setCurrency($currencySymbol);
            $customer->setExtensionAttributes($extensionAttributes);
            return $customer;
        }
    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。