Skip to content

Commit 92b7a46

Browse files
author
Stanislav Idolov
committed
Merge remote-tracking branch 'mainline/develop' into eav_batching
2 parents d2cca2c + f8b51d3 commit 92b7a46

File tree

412 files changed

+5063
-844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

412 files changed

+5063
-844
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
/.settings
66
atlassian*
77
/nbproject
8+
/robots.txt
9+
/pub/robots.txt
810
/sitemap
911
/sitemap.xml
12+
/pub/sitemap
13+
/pub/sitemap.xml
1014
/.idea
1115
/.gitattributes
1216
/app/config_sandbox

.travis.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ addons:
99
- postfix
1010
language: php
1111
php:
12-
- 5.6.29
1312
- 7.0
1413
env:
1514
global:
@@ -30,12 +29,6 @@ cache:
3029
- $HOME/.nvm
3130
- $HOME/node_modules
3231
- $HOME/yarn.lock
33-
matrix:
34-
exclude:
35-
- php: 5.6.29
36-
env: TEST_SUITE=static
37-
- php: 5.6.29
38-
env: TEST_SUITE=js
3932
before_install: ./dev/travis/before_install.sh
4033
install: composer install --no-interaction --prefer-dist
4134
before_script: ./dev/travis/before_script.sh

app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function getContent();
138138
/**
139139
* Set media gallery content
140140
*
141-
* @param $content \Magento\Framework\Api\Data\ImageContentInterface
141+
* @param \Magento\Framework\Api\Data\ImageContentInterface $content
142142
* @return $this
143143
*/
144144
public function setContent($content);

app/code/Magento/Catalog/Block/Product/View/Options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function getJsonConfig()
208208
$config = [];
209209
foreach ($this->getOptions() as $option) {
210210
/* @var $option \Magento\Catalog\Model\Product\Option */
211-
if ($option->getGroupByType() == \Magento\Catalog\Model\Product\Option::OPTION_GROUP_SELECT) {
211+
if ($option->hasValues()) {
212212
$tmpPriceValues = [];
213213
foreach ($option->getValues() as $valueId => $value) {
214214
$tmpPriceValues[$valueId] = $this->_getPriceConfiguration($value);

app/code/Magento/Catalog/Model/Category.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
116116
* URL rewrite model
117117
*
118118
* @var \Magento\UrlRewrite\Model\UrlRewrite
119+
* @deprecated since 2.2.0
119120
*/
120121
protected $_urlRewrite;
121122

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,15 @@ public function setIsDuplicable($value)
16171617
*/
16181618
public function isSalable()
16191619
{
1620-
if ($this->hasData('salable') && !$this->_catalogProduct->getSkipSaleableCheck()) {
1620+
if ($this->_catalogProduct->getSkipSaleableCheck()) {
1621+
return true;
1622+
}
1623+
if (($this->getOrigData('status') != $this->getData('status'))
1624+
|| $this->isStockStatusChanged()) {
1625+
$this->unsetData('salable');
1626+
}
1627+
1628+
if ($this->hasData('salable')) {
16211629
return $this->getData('salable');
16221630
}
16231631
$this->_eventManager->dispatch('catalog_product_is_salable_before', ['product' => $this]);
@@ -1630,7 +1638,7 @@ public function isSalable()
16301638
['product' => $this, 'salable' => $object]
16311639
);
16321640
$this->setData('salable', $object->getIsSalable());
1633-
return $object->getIsSalable();
1641+
return $this->getData('salable');
16341642
}
16351643

16361644
/**
@@ -1640,7 +1648,7 @@ public function isSalable()
16401648
*/
16411649
public function isAvailable()
16421650
{
1643-
return $this->getTypeInstance()->isSalable($this) || $this->_catalogProduct->getSkipSaleableCheck();
1651+
return $this->_catalogProduct->getSkipSaleableCheck() || $this->getTypeInstance()->isSalable($this);
16441652
}
16451653

16461654
/**

app/code/Magento/Catalog/Model/Product/Option.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,17 @@ public function getValueById($valueId)
217217
return null;
218218
}
219219

220+
/**
221+
* Whether or not the option type contains sub-values
222+
*
223+
* @param string $type
224+
* @return bool
225+
*/
226+
public function hasValues($type = null)
227+
{
228+
return $this->getGroupByType($type) == self::OPTION_GROUP_SELECT;
229+
}
230+
220231
/**
221232
* @return ProductCustomOptionValuesInterface[]|null
222233
*/

app/code/Magento/Catalog/Test/Unit/Model/Product/OptionTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ public function testGetProductSku()
3535
$this->assertEquals($productSku, $this->model->getProductSku());
3636
}
3737

38+
public function testHasValues()
39+
{
40+
$this->model->setType('drop_down');
41+
$this->assertTrue($this->model->hasValues());
42+
43+
$this->model->setType('field');
44+
$this->assertFalse($this->model->hasValues());
45+
}
46+
3847
public function testGetRegularPrice()
3948
{
4049
$priceInfoMock = $this->getMockForAbstractClass(

app/code/Magento/CatalogInventory/Model/StockManagement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function registerProductsSale($items, $websiteId = null)
102102
if (!$stockItem->hasAdminArea()
103103
&& !$this->stockState->checkQty($productId, $orderedQty, $stockItem->getWebsiteId())
104104
) {
105-
$this->getResource()->commit();
105+
$this->getResource()->rollBack();
106106
throw new \Magento\Framework\Exception\LocalizedException(
107107
__('Not all of your products are available in the requested quantity.')
108108
);
@@ -180,7 +180,7 @@ protected function getProductType($productId)
180180
}
181181

182182
/**
183-
* @return Stock
183+
* @return ResourceStock
184184
*/
185185
protected function getResource()
186186
{

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ class Full
156156
*/
157157
private $iteratorFactory;
158158

159+
/**
160+
* @var \Magento\Framework\EntityManager\MetadataPool
161+
*/
162+
private $metadataPool;
163+
159164
/**
160165
* @param ResourceConnection $resource
161166
* @param \Magento\Catalog\Model\Product\Type $catalogProductType
@@ -175,6 +180,7 @@ class Full
175180
* @param \Magento\Framework\Search\Request\DimensionFactory $dimensionFactory
176181
* @param \Magento\Framework\Indexer\ConfigInterface $indexerConfig
177182
* @param \Magento\CatalogSearch\Model\Indexer\Fulltext\Action\IndexIteratorFactory $indexIteratorFactory
183+
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
178184
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
179185
*/
180186
public function __construct(
@@ -195,7 +201,8 @@ public function __construct(
195201
\Magento\CatalogSearch\Model\ResourceModel\Fulltext $fulltextResource,
196202
\Magento\Framework\Search\Request\DimensionFactory $dimensionFactory,
197203
\Magento\Framework\Indexer\ConfigInterface $indexerConfig,
198-
\Magento\CatalogSearch\Model\Indexer\Fulltext\Action\IndexIteratorFactory $indexIteratorFactory
204+
\Magento\CatalogSearch\Model\Indexer\Fulltext\Action\IndexIteratorFactory $indexIteratorFactory,
205+
\Magento\Framework\EntityManager\MetadataPool $metadataPool = null
199206
) {
200207
$this->resource = $resource;
201208
$this->connection = $resource->getConnection();
@@ -216,6 +223,8 @@ public function __construct(
216223
$this->fulltextResource = $fulltextResource;
217224
$this->dimensionFactory = $dimensionFactory;
218225
$this->iteratorFactory = $indexIteratorFactory;
226+
$this->metadataPool = $metadataPool ?: \Magento\Framework\App\ObjectManager::getInstance()
227+
->get(\Magento\Framework\EntityManager\MetadataPool::class);
219228
}
220229

221230
/**
@@ -252,14 +261,22 @@ protected function getTable($table)
252261
*/
253262
protected function getProductIdsFromParents(array $entityIds)
254263
{
255-
return $this->connection
264+
/** @var \Magento\Framework\EntityManager\EntityMetadataInterface $metadata */
265+
$metadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
266+
$fieldForParent = $metadata->getLinkField();
267+
268+
$select = $this->connection
256269
->select()
257-
->from($this->getTable('catalog_product_relation'), 'parent_id')
270+
->from(['relation' => $this->getTable('catalog_product_relation')], [])
258271
->distinct(true)
259272
->where('child_id IN (?)', $entityIds)
260273
->where('parent_id NOT IN (?)', $entityIds)
261-
->query()
262-
->fetchAll(\Zend_Db::FETCH_COLUMN);
274+
->join(
275+
['cpe' => $this->getTable('catalog_product_entity')],
276+
'relation.parent_id = cpe.' . $fieldForParent,
277+
['cpe.entity_id']
278+
);
279+
return $this->connection->fetchCol($select);
263280
}
264281

265282
/**

0 commit comments

Comments
 (0)