Skip to content

Commit 7541ee0

Browse files
author
iminiailo
committed
Merge pull request #67 from magento-dragons/S60
[Dragon] - S60
2 parents c67bf2c + 6c33550 commit 7541ee0

File tree

154 files changed

+8508
-4099
lines changed

Some content is hidden

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

154 files changed

+8508
-4099
lines changed

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 193 additions & 130 deletions
Large diffs are not rendered by default.

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

Lines changed: 334 additions & 179 deletions
Large diffs are not rendered by default.

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ interface EavAttributeInterface extends \Magento\Eav\Api\Data\AttributeInterface
2222

2323
const APPLY_TO = 'apply_to';
2424

25-
const IS_CONFIGURABLE = 'is_configurable';
26-
2725
const IS_SEARCHABLE = 'is_searchable';
2826

2927
const IS_VISIBLE_IN_ADVANCED_SEARCH = 'is_visible_in_advanced_search';
@@ -95,12 +93,6 @@ public function getPosition();
9593
*/
9694
public function getApplyTo();
9795

98-
/**
99-
* Whether the attribute can be used for configurable products
100-
*
101-
* @return string|null
102-
*/
103-
public function getIsConfigurable();
10496
/**
10597
* Whether the attribute can be used in Quick Search
10698
*

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,6 @@ public function setApplyTo($applyTo)
118118
return $this;
119119
}
120120

121-
/**
122-
* @param string|null $isConfigurable
123-
* @return $this
124-
*/
125-
public function setIsConfigurable($isConfigurable)
126-
{
127-
$this->_set('is_configurable', $isConfigurable);
128-
return $this;
129-
}
130-
131121
/**
132122
* @param string|null $isSearchable
133123
* @return $this

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,6 @@ public function getIsSearchable()
8383
return $this->getData(self::IS_SEARCHABLE);
8484
}
8585

86-
/**
87-
* {@inheritdoc}
88-
*/
89-
public function getIsConfigurable()
90-
{
91-
return $this->getData(self::IS_CONFIGURABLE);
92-
}
93-
9486
/**
9587
* {@inheritdoc}
9688
*/

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ public function deleteChildren(\Magento\Framework\Object $object)
223223
*
224224
* @param \Magento\Framework\Object $object
225225
* @return $this
226+
* @SuppressWarnings(PHPMD.NPathComplexity)
227+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
226228
*/
227229
protected function _beforeSave(\Magento\Framework\Object $object)
228230
{
@@ -231,23 +233,27 @@ protected function _beforeSave(\Magento\Framework\Object $object)
231233
if (!$object->getChildrenCount()) {
232234
$object->setChildrenCount(0);
233235
}
234-
if ($object->getLevel() === null) {
235-
$object->setLevel(1);
236-
}
237236

238-
if (!$object->getId()) {
237+
if ($object->isObjectNew()) {
239238
if (is_null($object->getPosition())) {
240239
$object->setPosition($this->_getMaxPosition($object->getPath()) + 1);
241240
}
242241
$path = explode('/', $object->getPath());
243-
$level = count($path);
244-
$object->setLevel($level);
245-
if ($level) {
242+
$level = count($path) - ($object->getId() ? 1 : 0);
243+
$toUpdateChild = array_diff($path, [$object->getId()]);
244+
245+
if (!$object->hasPosition()) {
246+
$object->setPosition($this->_getMaxPosition(implode('/', $toUpdateChild)) + 1);
247+
}
248+
if (!$object->hasLevel()) {
249+
$object->setLevel($level);
250+
}
251+
if (!$object->hasParentId() && $level) {
246252
$object->setParentId($path[$level - 1]);
247253
}
248-
$object->setPath($object->getPath() . '/');
249-
250-
$toUpdateChild = explode('/', $object->getPath());
254+
if (!$object->getId()) {
255+
$object->setPath($object->getPath() . '/');
256+
}
251257

252258
$this->_getWriteAdapter()->update(
253259
$this->getEntityTable(),

app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,6 @@ public function getPosition()
544544
return $this->getData(self::POSITION);
545545
}
546546

547-
/**
548-
* {@inheritdoc}
549-
*/
550-
public function getIsConfigurable()
551-
{
552-
return $this->getData(self::IS_CONFIGURABLE);
553-
}
554-
555547
/**
556548
* {@inheritdoc}
557549
*/

app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
->load(1)
1515
->setId(1)
1616
->setStoreId(0)
17-
->setPath(1)
17+
->setPath('1')
1818
->setLevel(0)
1919
->setPosition(0)
2020
->setChildrenCount(0)
@@ -26,11 +26,12 @@
2626

2727
$installer->createCategory()
2828
->setStoreId(0)
29+
->setPath('1')
2930
->setName('Default Category')
3031
->setDisplayMode('PRODUCTS')
3132
->setAttributeSetId($category->getDefaultAttributeSetId())
3233
->setIsActive(1)
33-
->setPath('1')
34+
->setLevel(1)
3435
->setInitialSetupFlag(true)
3536
->save();
3637

app/code/Magento/CatalogSearch/Block/Advanced/Form.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function _prepareLayout()
8282
*/
8383
public function getSearchableAttributes()
8484
{
85-
$attributes = $this->getModel()->getAttributes();
85+
$attributes = $this->_catalogSearchAdvanced->getAttributes();
8686
return $attributes;
8787
}
8888

@@ -315,16 +315,6 @@ protected function _getDateBlock()
315315
return $block;
316316
}
317317

318-
/**
319-
* Retrieve advanced search model object
320-
*
321-
* @return Advanced
322-
*/
323-
public function getModel()
324-
{
325-
return $this->_catalogSearchAdvanced;
326-
}
327-
328318
/**
329319
* Retrieve search form action url
330320
*

app/code/Magento/CatalogSearch/Model/Advanced.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
use Magento\Catalog\Model\Resource\Eav\Attribute;
1212
use Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory;
1313
use Magento\CatalogSearch\Model\Resource\Advanced\Collection;
14-
use Magento\CatalogSearch\Model\Resource\EngineInterface;
15-
use Magento\CatalogSearch\Model\Resource\EngineProvider;
14+
use Magento\CatalogSearch\Model\Resource\ResourceProvider;
1615
use Magento\Directory\Model\Currency;
1716
use Magento\Directory\Model\CurrencyFactory;
1817
use Magento\Eav\Model\Entity\Attribute as EntityAttribute;
@@ -53,13 +52,6 @@ class Advanced extends \Magento\Framework\Model\AbstractModel
5352
*/
5453
protected $_searchCriterias = [];
5554

56-
/**
57-
* Current search engine
58-
*
59-
* @var EngineInterface
60-
*/
61-
protected $_engine;
62-
6355
/**
6456
* Found products collection
6557
*
@@ -109,6 +101,13 @@ class Advanced extends \Magento\Framework\Model\AbstractModel
109101
*/
110102
protected $_currencyFactory;
111103

104+
/**
105+
* Resources factory
106+
*
107+
* @var ResourceProvider
108+
*/
109+
protected $_resourceProvider;
110+
112111
/**
113112
* Construct
114113
*
@@ -117,10 +116,10 @@ class Advanced extends \Magento\Framework\Model\AbstractModel
117116
* @param CollectionFactory $attributeCollectionFactory
118117
* @param Visibility $catalogProductVisibility
119118
* @param Config $catalogConfig
120-
* @param EngineProvider $engineProvider
121119
* @param CurrencyFactory $currencyFactory
122120
* @param ProductFactory $productFactory
123121
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
122+
* @param ResourceProvider $resourceProvider
124123
* @param array $data
125124
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
126125
*/
@@ -130,24 +129,24 @@ public function __construct(
130129
CollectionFactory $attributeCollectionFactory,
131130
Visibility $catalogProductVisibility,
132131
Config $catalogConfig,
133-
EngineProvider $engineProvider,
134132
CurrencyFactory $currencyFactory,
135133
ProductFactory $productFactory,
136134
StoreManagerInterface $storeManager,
135+
ResourceProvider $resourceProvider,
137136
array $data = []
138137
) {
139138
$this->_attributeCollectionFactory = $attributeCollectionFactory;
140139
$this->_catalogProductVisibility = $catalogProductVisibility;
141140
$this->_catalogConfig = $catalogConfig;
142-
$this->_engine = $engineProvider->get();
143141
$this->_currencyFactory = $currencyFactory;
144142
$this->_productFactory = $productFactory;
145143
$this->_storeManager = $storeManager;
144+
$this->_resourceProvider = $resourceProvider;
146145
parent::__construct(
147146
$context,
148147
$registry,
149-
$this->_engine->getResource(),
150-
$this->_engine->getResourceCollection(),
148+
$this->_resourceProvider->getResource(),
149+
$this->_resourceProvider->getResourceCollection(),
151150
$data
152151
);
153152
}
@@ -250,7 +249,7 @@ public function getAttributes()
250249
public function getProductCollection()
251250
{
252251
if (is_null($this->_productCollection)) {
253-
$collection = $this->_engine->getAdvancedResultCollection();
252+
$collection = $this->_resourceProvider->getAdvancedResultCollection();
254253
$this->prepareProductCollection($collection);
255254
if (!$collection) {
256255
return $collection;

0 commit comments

Comments
 (0)