Skip to content

Commit b1c944b

Browse files
committed
MAGETWO-96118: Few optimizations on category & product pages
1 parent b1bf893 commit b1c944b

File tree

5 files changed

+39
-5
lines changed

5 files changed

+39
-5
lines changed

app/code/Magento/Catalog/Model/Product/Gallery/ReadHandler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public function __construct(
4747
}
4848

4949
/**
50+
* Execute read handler for catalog product gallery
51+
*
5052
* @param Product $entity
5153
* @param array $arguments
5254
* @return object
@@ -69,6 +71,8 @@ public function execute($entity, $arguments = [])
6971
}
7072

7173
/**
74+
* Add media data to product
75+
*
7276
* @param Product $product
7377
* @param array $mediaEntries
7478
* @return void
@@ -86,6 +90,8 @@ public function addMediaDataToProduct(Product $product, array $mediaEntries)
8690
}
8791

8892
/**
93+
* Get attribute
94+
*
8995
* @return \Magento\Catalog\Api\Data\ProductAttributeInterface
9096
* @since 101.0.0
9197
*/
@@ -99,6 +105,8 @@ public function getAttribute()
99105
}
100106

101107
/**
108+
* Find default value
109+
*
102110
* @param string $key
103111
* @param string[] &$image
104112
* @return string

app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public function __construct(
4949
}
5050

5151
/**
52-
* {@inheritdoc}
52+
* @inheritdoc
53+
*
5354
* @since 101.0.0
5455
*/
5556
protected function _construct()
@@ -58,7 +59,8 @@ protected function _construct()
5859
}
5960

6061
/**
61-
* {@inheritdoc}
62+
* @inheritdoc
63+
*
6264
* @since 101.0.0
6365
*/
6466
public function getConnection()
@@ -67,6 +69,8 @@ public function getConnection()
6769
}
6870

6971
/**
72+
* Load data from table by valueId
73+
*
7074
* @param string $tableNameAlias
7175
* @param array $ids
7276
* @param int|null $storeId
@@ -111,6 +115,8 @@ public function loadDataFromTableByValueId(
111115
}
112116

113117
/**
118+
* Load product gallery by attributeId
119+
*
114120
* @param \Magento\Catalog\Model\Product $product
115121
* @param int $attributeId
116122
* @return array
@@ -132,6 +138,8 @@ public function loadProductGalleryByAttributeId($product, $attributeId)
132138
}
133139

134140
/**
141+
* Create base load select
142+
*
135143
* @param int $entityId
136144
* @param int $storeId
137145
* @param int $attributeId
@@ -151,6 +159,8 @@ protected function createBaseLoadSelect($entityId, $storeId, $attributeId)
151159
}
152160

153161
/**
162+
* Create batch base select
163+
*
154164
* @param int $storeId
155165
* @param int $attributeId
156166
* @return \Magento\Framework\DB\Select
@@ -247,6 +257,8 @@ protected function removeDuplicates(&$result)
247257
}
248258

249259
/**
260+
* Get main table alias
261+
*
250262
* @return string
251263
* @since 101.0.0
252264
*/
@@ -256,6 +268,8 @@ public function getMainTableAlias()
256268
}
257269

258270
/**
271+
* Bind value to entity
272+
*
259273
* @param int $valueId
260274
* @param int $entityId
261275
* @return int
@@ -273,6 +287,8 @@ public function bindValueToEntity($valueId, $entityId)
273287
}
274288

275289
/**
290+
* Save data row
291+
*
276292
* @param string $table
277293
* @param array $data
278294
* @param array $fields

app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
use Magento\Framework\App\ObjectManager;
2020
use Magento\Framework\DB\Adapter\AdapterInterface;
2121

22+
/**
23+
* Configurable product resource model.
24+
*/
2225
class Configurable extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
2326
{
2427
/**

app/code/Magento/ConfigurableProduct/Plugin/Catalog/Model/Product/Pricing/Renderer/SalableResolver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ public function __construct(
2727
}
2828

2929
/**
30-
* Performs an additional check whether given configurable product has
31-
* at least one configuration in-stock.
30+
* Performs an additional check whether given configurable product has at least one configuration in-stock.
3231
*
3332
* @param \Magento\Catalog\Model\Product\Pricing\Renderer\SalableResolver $subject
3433
* @param bool $result

app/code/Magento/ProductVideo/Model/Plugin/ExternalVideoResourceBackend.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public function __construct(\Magento\ProductVideo\Model\ResourceModel\Video $vid
2727
}
2828

2929
/**
30+
* Plugin for after duplicate action
31+
*
3032
* @param Gallery $originalResourceModel
3133
* @param array $valueIdMap
3234
* @return array
@@ -45,6 +47,8 @@ public function afterDuplicate(Gallery $originalResourceModel, array $valueIdMap
4547
}
4648

4749
/**
50+
* Plugin for after create batch base select action
51+
*
4852
* @param Gallery $originalResourceModel
4953
* @param Select $select
5054
* @return Select
@@ -62,7 +66,11 @@ public function afterCreateBatchBaseSelect(Gallery $originalResourceModel, Selec
6266
),
6367
[]
6468
)->joinLeft(
65-
['default_value_video' => $originalResourceModel->getTable('catalog_product_entity_media_gallery_value_video')],
69+
[
70+
'default_value_video' => $originalResourceModel->getTable(
71+
'catalog_product_entity_media_gallery_value_video'
72+
)
73+
],
6674
implode(
6775
' AND ',
6876
[

0 commit comments

Comments
 (0)