Lights Out: Take Different Angle
Taking a different angle
Taking this data back to the our breakpoint, we see:
- $dataObject = Magento\Sales\Api\Data\OrderExtension
- $dataObjectType = Magento\Sales\Api\Data\OrderItemExtensionInterface
Something is clearly broken here as $dataObjectType matches the list, but $dataObject does not.
But, perhaps it’s a better question to ask: “why is this method trying to call getHsCode?” This is an excellent example of backing up and trying from a different perspective. Why? Either getHsCode is missing, or getHsCode shouldn’t be called in the first place.
The quick answer is because $dataObjectType’s interface does have getHsCode but $dataObject does not.
I suggest we look in the rear-view mirror, the stack trace:
You should immediately recognize a couple of these (starting from the bottom):
- Magento\Quote\Model\QuoteManagement\Interceptor::placeOrder
- Magento\Quote\Model\QuoteManagement::submit
Once these methods are hit, it seems that something is getting merged:
Magento\Framework\Api\DataObjectHelper::mergeDataObjects
Surprisingly, we see that the order is created, then the shipping address is converted to an order and the two are merged together!