Skip to content

Commit 0b8abe0

Browse files
committed
Merge remote-tracking branch 'andrew/fixes-for-data-object' into ph-delivery
2 parents 2fa337d + d148161 commit 0b8abe0

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ protected function _getValue(DataObject $row)
9797
}
9898
return '';
9999
}
100-
return $row->getData($this->getColumn()->getIndex());
100+
return $this->getColumn()->getIndex() !== null
101+
? $row->getData($this->getColumn()->getIndex())
102+
: null;
101103
}
102104

103105
/**

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,14 @@ protected function _getCurrencyCode($row)
118118
protected function _getRate($row)
119119
{
120120
if ($rate = $this->getColumn()->getRate()) {
121-
return (float)$rate;
121+
return (float) $rate;
122122
}
123-
if ($rate = $row->getData($this->getColumn()->getRateField())) {
124-
return (float)$rate;
123+
$rateField = $this->getColumn()->getRateField();
124+
125+
if ($rateField !== null && $rate = $row->getData($rateField)) {
126+
return (float) $rate;
125127
}
128+
126129
return $this->_defaultBaseCurrency->getRate($this->_getCurrencyCode($row));
127130
}
128131

lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/Document.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Framework\Api\AttributeValueFactory;
1111

1212
/**
13-
* Class Document
13+
* The document data provider
1414
*/
1515
class Document extends DataObject implements DocumentInterface
1616
{
@@ -33,17 +33,23 @@ public function __construct(AttributeValueFactory $attributeValueFactory)
3333
}
3434

3535
/**
36+
* Gets ID.
37+
*
3638
* @return int|string
3739
*/
3840
public function getId()
3941
{
4042
if (!$this->id) {
41-
$this->id = $this->getData($this->getIdFieldName());
43+
$this->id = $this->getIdFieldName() !== null
44+
? $this->getData($this->getIdFieldName())
45+
: null;
4246
}
4347
return $this->id;
4448
}
4549

4650
/**
51+
* Sets ID.
52+
*
4753
* @param int $id
4854
* @return void
4955
*/

0 commit comments

Comments
 (0)