Skip to content

Commit 679219d

Browse files
author
Valeriy Nayda
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-62271
2 parents 3bea12a + 2bc3bb0 commit 679219d

File tree

187 files changed

+5578
-2443
lines changed

Some content is hidden

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

187 files changed

+5578
-2443
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ atlassian*
4848
/pub/media/favicon/*
4949
/pub/media/import/*
5050
!/pub/media/import/.htaccess
51+
/pub/media/logo/*
5152
/pub/media/theme/*
5253
/pub/media/theme_customization/*
5354
!/pub/media/theme_customization/.htaccess

app/autoload.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,3 @@
3535
}
3636

3737
AutoloaderRegistry::registerAutoloader(new ClassLoaderWrapper($composerAutoloader));
38-
39-
// Sets default autoload mappings, may be overridden in Bootstrap::create
40-
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);

app/bootstrap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
}
2929

3030
require_once __DIR__ . '/autoload.php';
31+
// Sets default autoload mappings, may be overridden in Bootstrap::create
32+
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);
33+
3134
require_once BP . '/app/functions.php';
3235

3336
/* Custom umask value may be provided in optional mage_umask file in root */

app/code/Magento/Bundle/Model/Product/Price.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento\Bundle\Model\Product;
87

98
use Magento\Customer\Api\GroupManagementInterface;
109
use Magento\Framework\Pricing\PriceCurrencyInterface;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory;
1112

1213
/**
13-
* Bundle Price Model
14-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1514
* @api
15+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1616
*/
1717
class Price extends \Magento\Catalog\Model\Product\Type\Price
1818
{
@@ -48,7 +48,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price
4848
private $serializer;
4949

5050
/**
51-
* Price constructor.
51+
* Constructor
5252
*
5353
* @param \Magento\CatalogRule\Model\ResourceModel\RuleFactory $ruleFactory
5454
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
@@ -61,6 +61,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price
6161
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
6262
* @param \Magento\Catalog\Helper\Data $catalogData
6363
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
64+
* @param ProductTierPriceExtensionFactory|null $tierPriceExtensionFactory
6465
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
6566
*/
6667
public function __construct(
@@ -74,10 +75,11 @@ public function __construct(
7475
\Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory,
7576
\Magento\Framework\App\Config\ScopeConfigInterface $config,
7677
\Magento\Catalog\Helper\Data $catalogData,
77-
\Magento\Framework\Serialize\Serializer\Json $serializer = null
78+
\Magento\Framework\Serialize\Serializer\Json $serializer = null,
79+
ProductTierPriceExtensionFactory $tierPriceExtensionFactory = null
7880
) {
7981
$this->_catalogData = $catalogData;
80-
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
82+
$this->serializer = $serializer ?: ObjectManager::getInstance()
8183
->get(\Magento\Framework\Serialize\Serializer\Json::class);
8284
parent::__construct(
8385
$ruleFactory,
@@ -88,7 +90,8 @@ public function __construct(
8890
$priceCurrency,
8991
$groupManagement,
9092
$tierPriceFactory,
91-
$config
93+
$config,
94+
$tierPriceExtensionFactory
9295
);
9396
}
9497

app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
namespace Magento\Bundle\Test\Unit\Model\Product;
77

88
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
9+
use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory;
910

1011
/**
11-
* Test for Model ProductPrice.
12-
*
1312
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1413
*/
1514
class PriceTest extends \PHPUnit_Framework_TestCase
@@ -114,7 +113,10 @@ function ($value) {
114113
return json_decode($value, true);
115114
}
116115
);
117-
116+
$tierPriceExtensionFactoryMock = $this->getMockBuilder(ProductTierPriceExtensionFactory::class)
117+
->setMethods(['create'])
118+
->disableOriginalConstructor()
119+
->getMock();
118120
$objectManagerHelper = new ObjectManagerHelper($this);
119121
$this->model = $objectManagerHelper->getObject(
120122
\Magento\Bundle\Model\Product\Price::class,
@@ -129,7 +131,8 @@ function ($value) {
129131
'tierPriceFactory' => $tpFactory,
130132
'config' => $scopeConfig,
131133
'catalogData' => $this->catalogHelperMock,
132-
'serializer' => $this->serializer
134+
'serializer' => $this->serializer,
135+
'tierPriceExtensionFactory' => $tierPriceExtensionFactoryMock
133136
]
134137
);
135138
}

app/code/Magento/Catalog/Block/Product/ProductList/Related.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ protected function _beforeToHtml()
116116
*/
117117
public function getItems()
118118
{
119+
/**
120+
* getIdentities() depends on _itemCollection populated, but it can be empty if the block is hidden
121+
* @see https://github.com/magento/magento2/issues/5897
122+
*/
123+
if (is_null($this->_itemCollection)) {
124+
$this->_prepareData();
125+
}
119126
return $this->_itemCollection;
120127
}
121128

app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ protected function _beforeToHtml()
135135
*/
136136
public function getItemCollection()
137137
{
138+
/**
139+
* getIdentities() depends on _itemCollection populated, but it can be empty if the block is hidden
140+
* @see https://github.com/magento/magento2/issues/5897
141+
*/
142+
if (is_null($this->_itemCollection)) {
143+
$this->_prepareData();
144+
}
138145
return $this->_itemCollection;
139146
}
140147

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ public function getGalleryImagesJson()
122122
}
123123
if (empty($imagesItems)) {
124124
$imagesItems[] = [
125-
'thumb' => $this->getImage($this->getProduct(), 'product_thumbnail_image')->getImageUrl(),
126-
'img' => $this->getImage($this->getProduct(), 'product_base_image')->getImageUrl(),
127-
'full' => $this->getImage($this->getProduct(), 'product_page_image_large')->getImageUrl(),
125+
'thumb' => $this->_imageHelper->getDefaultPlaceholderUrl('thumbnail'),
126+
'img' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
127+
'full' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
128128
'caption' => '',
129129
'position' => '0',
130130
'isMain' => true,

app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -73,18 +72,24 @@ class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Produ
7372
protected $extensionAttributesFactory;
7473

7574
/**
75+
* Constructor
76+
*
7677
* @param \Magento\Backend\App\Action\Context $context
7778
* @param Builder $productBuilder
7879
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
80+
* @param \Magento\Eav\Api\Data\AttributeGroupInterfaceFactory|null $attributeGroupFactory
7981
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8082
*/
8183
public function __construct(
8284
\Magento\Backend\App\Action\Context $context,
8385
\Magento\Catalog\Controller\Adminhtml\Product\Builder $productBuilder,
84-
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
86+
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
87+
\Magento\Eav\Api\Data\AttributeGroupInterfaceFactory $attributeGroupFactory = null
8588
) {
8689
parent::__construct($context, $productBuilder);
8790
$this->resultJsonFactory = $resultJsonFactory;
91+
$this->attributeGroupFactory = $attributeGroupFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
92+
->get(\Magento\Eav\Api\Data\AttributeGroupInterfaceFactory::class);
8893
}
8994

9095
/**
@@ -125,7 +130,7 @@ public function execute()
125130
$attributeGroup = reset($attributeGroupItems);
126131
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
127132
/** @var AttributeGroupInterface $attributeGroup */
128-
$attributeGroup = $this->getAttributeGroupFactory()->create();
133+
$attributeGroup = $this->attributeGroupFactory->create();
129134
}
130135

131136
$extensionAttributes = $attributeGroup->getExtensionAttributes()
@@ -221,18 +226,6 @@ private function getAttributeGroupRepository()
221226
return $this->attributeGroupRepository;
222227
}
223228

224-
/**
225-
* @return AttributeGroupInterfaceFactory
226-
*/
227-
private function getAttributeGroupFactory()
228-
{
229-
if (null === $this->attributeGroupFactory) {
230-
$this->attributeGroupFactory = \Magento\Framework\App\ObjectManager::getInstance()
231-
->get(\Magento\Eav\Api\Data\AttributeGroupInterfaceFactory::class);
232-
}
233-
return $this->attributeGroupFactory;
234-
}
235-
236229
/**
237230
* @return SearchCriteriaBuilder
238231
*/

app/code/Magento/Catalog/Controller/Adminhtml/Product/Builder.php

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -41,21 +40,27 @@ class Builder
4140
protected $storeFactory;
4241

4342
/**
43+
* Constructor
44+
*
4445
* @param ProductFactory $productFactory
4546
* @param Logger $logger
4647
* @param Registry $registry
4748
* @param WysiwygModel\Config $wysiwygConfig
49+
* @param StoreFactory|null $storeFactory
4850
*/
4951
public function __construct(
5052
ProductFactory $productFactory,
5153
Logger $logger,
5254
Registry $registry,
53-
WysiwygModel\Config $wysiwygConfig
55+
WysiwygModel\Config $wysiwygConfig,
56+
StoreFactory $storeFactory = null
5457
) {
5558
$this->productFactory = $productFactory;
5659
$this->logger = $logger;
5760
$this->registry = $registry;
5861
$this->wysiwygConfig = $wysiwygConfig;
62+
$this->storeFactory = $storeFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
63+
->get(\Magento\Store\Model\StoreFactory::class);
5964
}
6065

6166
/**
@@ -70,7 +75,7 @@ public function build(RequestInterface $request)
7075
/** @var $product \Magento\Catalog\Model\Product */
7176
$product = $this->productFactory->create();
7277
$product->setStoreId($request->getParam('store', 0));
73-
$store = $this->getStoreFactory()->create();
78+
$store = $this->storeFactory->create();
7479
$store->load($request->getParam('store', 0));
7580

7681
$typeId = $request->getParam('type');
@@ -99,16 +104,4 @@ public function build(RequestInterface $request)
99104
$this->wysiwygConfig->setStoreId($request->getParam('store'));
100105
return $product;
101106
}
102-
103-
/**
104-
* @return StoreFactory
105-
*/
106-
private function getStoreFactory()
107-
{
108-
if (null === $this->storeFactory) {
109-
$this->storeFactory = \Magento\Framework\App\ObjectManager::getInstance()
110-
->get(\Magento\Store\Model\StoreFactory::class);
111-
}
112-
return $this->storeFactory;
113-
}
114107
}

0 commit comments

Comments
 (0)