Skip to content

Commit 6f02d36

Browse files
author
Klymenko, Volodymyr(vklymenko)
committed
Merge pull request #583 from magento-dragons/MAGETWO-40862
MAGETWO-40565: Improve Sample Data Performance
2 parents 73aa5bf + 98df0aa commit 6f02d36

File tree

7 files changed

+237
-133
lines changed

7 files changed

+237
-133
lines changed

app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ protected function setUp()
7878
$connection->expects($this->any())->method('quoteInto')->will($this->returnValue('query'));
7979
$select->expects($this->any())->method('getConnection')->willReturn($connection);
8080
$this->connection->expects($this->any())->method('select')->will($this->returnValue($select));
81-
$this->connection->expects($this->any())->method('fetchPairs')->will($this->returnValue([
82-
'1' => '1', '2' => '2'
83-
]));
81+
$this->connection->expects($this->any())->method('fetchAll')->will($this->returnValue([]));
8482
$this->connection->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
8583
$this->connection->expects($this->any())->method('delete')->willReturnSelf();
8684
$this->connection->expects($this->any())->method('quoteInto')->willReturn('');

app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ protected function _initAttributes()
184184
{
185185
// temporary storage for attributes' parameters to avoid double querying inside the loop
186186
$entityId = $this->_entityModel->getEntityTypeId();
187-
$entityAttributes = $this->_connection->fetchPairs(
187+
$entityAttributes = $this->_connection->fetchAll(
188188
$this->_connection->select()->from(
189189
['attr' => $this->_resource->getTableName('eav_entity_attribute')],
190190
['attr.attribute_id']
@@ -197,7 +197,10 @@ protected function _initAttributes()
197197
)
198198
);
199199
$absentKeys = [];
200-
foreach ($entityAttributes as $attributeId => $attributeSetName) {
200+
foreach ($entityAttributes as $item) {
201+
$attributeId = $item['attribute_id'];
202+
$attributeSetName = $item['attribute_set_name'];
203+
201204
if (!isset(self::$commonAttributesCache[$attributeId])) {
202205
if (!isset($absentKeys[$attributeSetName])) {
203206
$absentKeys[$attributeSetName] = [];
@@ -208,7 +211,10 @@ protected function _initAttributes()
208211
foreach ($absentKeys as $attributeSetName => $attributeIds) {
209212
$this->attachAttributesById($attributeSetName, $attributeIds);
210213
}
211-
foreach ($entityAttributes as $attributeId => $attributeSetName) {
214+
foreach ($entityAttributes as $item) {
215+
$attributeId = $item['attribute_id'];
216+
$attributeSetName = $item['attribute_set_name'];
217+
212218
if (isset(self::$commonAttributesCache[$attributeId])) {
213219
$attribute = self::$commonAttributesCache[$attributeId];
214220
$this->_addAttributeParams(

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/AbstractTypeTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,15 @@ protected function setUp()
192192
$this->connection->expects($this->any())->method('quoteInto')->willReturn('');
193193
$this->connection
194194
->expects($this->any())
195-
->method('fetchPairs')
196-
->will($this->returnValue($entityAttributes));
195+
->method('fetchAll')
196+
->will($this->returnValue(
197+
[
198+
[
199+
'attribute_id' => 'attribute_id',
200+
'attribute_set_name' => 'attribute_set_name'
201+
]
202+
]
203+
));
197204

198205
$this->resource = $this->getMock(
199206
'\Magento\Framework\App\Resource',

app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ protected function setUp()
208208
$this->_connection->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
209209
$this->_connection->expects($this->any())->method('delete')->willReturnSelf();
210210
$this->_connection->expects($this->any())->method('quoteInto')->willReturn('');
211-
$this->_connection->expects($this->any())->method('fetchPairs')->will($this->returnValue([]));
211+
$this->_connection->expects($this->any())->method('fetchAll')->will($this->returnValue([]));
212212

213213
$this->resource = $this->getMock(
214214
'\Magento\Framework\App\Resource',
@@ -524,7 +524,7 @@ public function testSaveData()
524524
['attribute_id' => 132, 'product_id' => 4, 'option_id' => 4, 'product_super_attribute_id' => 132],
525525
['attribute_id' => 132, 'product_id' => 5, 'option_id' => 5, 'product_super_attribute_id' => 132],
526526
]));
527-
$this->_connection->expects($this->any())->method('fetchPairs')->with($this->select)->will(
527+
$this->_connection->expects($this->any())->method('fetchAll')->with($this->select)->will(
528528
$this->returnValue([])
529529
);
530530

app/code/Magento/GroupedImportExport/Test/Unit/Model/Import/Product/Type/GroupedTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ protected function setUp()
110110
false
111111
);
112112
$entityAttributes = [
113-
'attribute_id' => 'attributeSetName'
113+
[
114+
'attribute_id' => 'attribute_id',
115+
'attribute_set_name' => 'attribute_set_name'
116+
]
114117
];
115118
$this->connection = $this->getMock(
116119
'Magento\Framework\DB\Adapter\Pdo\Mysql',
@@ -136,7 +139,7 @@ protected function setUp()
136139
$this->connection->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
137140
$this->connection->expects($this->any())->method('delete')->willReturnSelf();
138141
$this->connection->expects($this->any())->method('quoteInto')->willReturn('');
139-
$this->connection->expects($this->any())->method('fetchPairs')->will($this->returnValue($entityAttributes));
142+
$this->connection->expects($this->any())->method('fetchAll')->will($this->returnValue($entityAttributes));
140143
$this->resource = $this->getMock(
141144
'\Magento\Framework\App\Resource',
142145
['getConnection', 'getTableName'],

app/design/frontend/Magento/luma/etc/view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
<var name="gallery:loop">false</var> <!-- Gallery navigation loop (true/false) -->
189189
<var name="gallery:keyboard">true</var> <!-- Turn on/off keyboard arrows navigation (true/false) -->
190190
<var name="gallery:arrows">true</var> <!-- Turn on/off arrows on the sides preview (true/false) -->
191-
<var name="gallery:caption">true</var> <!-- Display alt text as image title (true/false) -->
191+
<var name="gallery:show_caption">true</var> <!-- Display alt text as image title (true/false) -->
192192

193193
<var name="magnifier:top"></var> <!-- Top position of magnifier -->
194194
<var name="magnifier:left"></var> <!-- Right position of magnifier -->

0 commit comments

Comments
 (0)