Closed
Description
Preconditions
- Magento 2.1
Steps to reproduce
- Create a custom module that add a field to quote and sales_order table
- Update the field in quote table and then place an order
Expected result
- The field value will get copied to the order table
Actual result
- The field does not get copy over to sales_order table
The issue seem to be cause by :
/vendor/magento/framework/Api/DataObjectHelper.php
Line 238
$secondObjectArray = $this->objectProcessor->buildOutputDataArray($secondDataObject, $interfaceName);
$this->_setDataValues($firstDataObject, $secondObjectArray, $interfaceName);
return $this;
vendor/magento/framework/Reflection/DataObjectProcessor.php
Line 75
public function buildOutputDataArray($dataObject, $dataObjectType)
{
$methods = $this->methodsMapProcessor->getMethodsMap($dataObjectType);
$outputData = [];
/** @var MethodReflection $method */
foreach (array_keys($methods) as $methodName) {
if (!$this->methodsMapProcessor->isMethodValidForDataField($dataObjectType, $methodName)) {
continue;
}
Since the method for the newly added db field is not defined in "\Magento\Sales\Api\Data\OrderInterface" it will not get copied in to "$secondObjectArray" therefore it will not get set in "$this->_setDataValues()"