3
我在现有客户实体的扩展期间通过安装模式成功安装了新的自定义属性。如何在magento 2中保存客户自定义属性
我的问题是,当我试图拯救客户,它给了我像下面的错误。
Fatal error: Call to a member function get() on a non-object in /var/www/html/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php on line 236
我想通过下面的代码保存客户属性:
$customerData[\Magento\Framework\Api\CustomAttributesDataInterface::CUSTOM_ATTRIBUTES] = [\Magento\Framework\Api\AttributeInterface::ATTRIBUTE_CODE=>'md_customer_profile_id',\Magento\Framework\Api\AttributeInterface::VALUE=>$customerProfileId];
$this->dataObjectHelper->populateWithArray($customerObject, $customerData, '\Magento\Customer\Api\Data\CustomerInterface');
$this->customerRepository->save($customerObject);