setIsInProcess($value)
方法是相應模型的setData('is_in_process', $value)
的別名。您可以在父類Magento\Framework\Model\AbstractExtensibleModel
或Magento\Framework\Model\AbstractModel
中找到它的定義。該魔術方法是在__call
方法(通常爲所有型號)Magento\Framework\DataObject
父類實現:
/**
* Set/Get attribute wrapper
*
* @param string $method
* @param array $args
* @return mixed
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function __call($method, $args)
{
switch (substr($method, 0, 3)) {
case 'get':
$key = $this->_underscore(substr($method, 3));
$index = isset($args[0]) ? $args[0] : null;
return $this->getData($key, $index);
case 'set':
$key = $this->_underscore(substr($method, 3));
$value = isset($args[0]) ? $args[0] : null;
return $this->setData($key, $value);
case 'uns':
$key = $this->_underscore(substr($method, 3));
return $this->unsetData($key);
case 'has':
$key = $this->_underscore(substr($method, 3));
return isset($this->_data[$key]);
}
throw new \Magento\Framework\Exception\LocalizedException(
new \Magento\Framework\Phrase('Invalid method %1::%2', [get_class($this), $method])
);
}
東西在Magento的1使用的類似,我會建議你閱讀this article written by Ryan Street
PS:它只在一個地方使用:Magento\Sales\Model\ResourceModel\Order\Handler\State::check(Order $order)
在第41行。我認爲這與你的問題有關,因爲這裏的訂單狀態和狀態正在改變爲處理。
謝謝您的回覆,我會接受。只是澄清一下:所以這意味着sales_order模型中應該有一個'is_in_process'屬性/字段可以設置爲true/false。可能它被映射到state ='processing'。我的猜測是對的嗎?我對Magento非常陌生,但仍然在爲它的魔力掙扎:) – sissy
@sissy它只用在一個地方:'Magento \ Sales \ Model \ ResourceModel \ Order \ Handler \ State :: check(Order $ order)'on第41行。我認爲這與你的問題有關,因爲這裏的訂單狀態和狀態正在改變爲處理。是的,你是對的:) –
再次感謝,非常好的提示,但不幸的是這並不能解決我的其他問題。我昨天問了一個問題https://stackoverflow.com/questions/46563363/creating-shipment-does-not-update-items-shipped-quantity-and-order-is-not-comple,甚至評論setIsInProcess,或嘗試強制一個完整的狀態,我的訂單仍然處理和項目發貨數量仍然是0.你是否也有線索?提前致謝。 – sissy