Skip to content

Commit 55debe0

Browse files
Merge forwardport of #12736 to 2.3-develop branch
Applied pull request patch https://github.com/magento/magento2/pull/12736.patch (created by @virtual97) based on commit(s): 1. a847d89 2. ae62931 Fixed GitHub Issues in 2.3-develop branch: - #12374: Model hasDataChanges always true (reported by @Detzler)
2 parents ac9bcfa + 00f64b0 commit 55debe0

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php

+1
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ public function load($printQuery = false, $logQuery = false)
920920
foreach ($this->_items as $item) {
921921
$item->setOrigData();
922922
$this->beforeAddLoadedItem($item);
923+
$item->setDataChanges(false);
923924
}
924925
\Magento\Framework\Profiler::stop('set_orig_data');
925926

app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/AbstractCollectionTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ public function tearDown()
135135
$this->model = null;
136136
}
137137

138+
/**
139+
* Test method \Magento\Eav\Model\Entity\Collection\AbstractCollection::load
140+
*/
141+
public function testLoad()
142+
{
143+
$this->fetchStrategyMock
144+
->expects($this->once())
145+
->method('fetchAll')
146+
->will($this->returnValue([['id' => 1, 'data_changes' => true], ['id' => 2]]));
147+
148+
foreach ($this->model->getItems() as $item) {
149+
$this->assertFalse($item->getDataChanges());
150+
}
151+
}
152+
138153
/**
139154
* @dataProvider getItemsDataProvider
140155
*/

0 commit comments

Comments
 (0)